Upstream some scattered Cobalt changes

These changes are found after Cobalt rebased to V8 v8.8. Most changes
are grouped into their own CLs and here are the rest.
- Replace raw printf with PrintF
- Include Starboard as a platform for some implementations
- Add some missing headers. This is probably because Cobalt does
  not compile all of V8 sources so some missing headers are only exposed
  when compiling Cobalt.

Change-Id: Idf1512f57c37c8a63f79b1cf4ffc1da5d08421e2
Bug: v8:10927
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2966197
Auto-Submit: John Xu <johnx@google.com>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: John Xu <johnx@google.com>
Cr-Commit-Position: refs/heads/master@{#75376}
This commit is contained in:
John Xu 2021-06-16 07:33:28 +00:00 committed by V8 LUCI CQ
parent e5b8ec490c
commit 5c0bf436eb
5 changed files with 23 additions and 10 deletions

View File

@ -1589,16 +1589,16 @@ Object Isolate::ThrowInternal(Object raw_exception, MessageLocation* location) {
Handle<Object> exception(raw_exception, this);
if (FLAG_print_all_exceptions) {
printf("=========================================================\n");
printf("Exception thrown:\n");
PrintF("=========================================================\n");
PrintF("Exception thrown:\n");
if (location) {
Handle<Script> script = location->script();
Handle<Object> name(script->GetNameOrSourceURL(), this);
printf("at ");
PrintF("at ");
if (name->IsString() && String::cast(*name).length() > 0)
String::cast(*name).PrintOn(stdout);
else
printf("<anonymous>");
PrintF("<anonymous>");
// Script::GetLineNumber and Script::GetColumnNumber can allocate on the heap to
// initialize the line_ends array, so be careful when calling them.
#ifdef DEBUG
@ -1606,7 +1606,7 @@ Object Isolate::ThrowInternal(Object raw_exception, MessageLocation* location) {
#else
if ((false)) {
#endif
printf(", %d:%d - %d:%d\n",
PrintF(", %d:%d - %d:%d\n",
Script::GetLineNumber(script, location->start_pos()) + 1,
Script::GetColumnNumber(script, location->start_pos()),
Script::GetLineNumber(script, location->end_pos()) + 1,
@ -1614,13 +1614,13 @@ Object Isolate::ThrowInternal(Object raw_exception, MessageLocation* location) {
// Make sure to update the raw exception pointer in case it moved.
raw_exception = *exception;
} else {
printf(", line %d\n", script->GetLineNumber(location->start_pos()) + 1);
PrintF(", line %d\n", script->GetLineNumber(location->start_pos()) + 1);
}
}
raw_exception.Print();
printf("Stack Trace:\n");
PrintF("Stack Trace:\n");
PrintStack(stdout);
printf("=========================================================\n");
PrintF("=========================================================\n");
}
// Determine whether a message needs to be created for the given exception

View File

@ -117,7 +117,10 @@ class GeneratedCode {
#ifdef USE_SIMULATOR
// Defined in simulator-base.h.
Return Call(Args... args) {
#if defined(V8_TARGET_OS_WIN) && !defined(V8_OS_WIN)
// Starboard is a platform abstraction interface that also include Windows
// platforms like UWP.
#if defined(V8_TARGET_OS_WIN) && !defined(V8_OS_WIN) && \
!defined(V8_OS_STARBOARD)
FATAL("Generated code execution not possible during cross-compilation.");
#endif // defined(V8_TARGET_OS_WIN) && !defined(V8_OS_WIN)
return Simulator::current(isolate_)->template Call<Return>(
@ -127,7 +130,10 @@ class GeneratedCode {
DISABLE_CFI_ICALL Return Call(Args... args) {
// When running without a simulator we call the entry directly.
#if defined(V8_TARGET_OS_WIN) && !defined(V8_OS_WIN)
// Starboard is a platform abstraction interface that also include Windows
// platforms like UWP.
#if defined(V8_TARGET_OS_WIN) && !defined(V8_OS_WIN) && \
!defined(V8_OS_STARBOARD)
FATAL("Generated code execution not possible during cross-compilation.");
#endif // defined(V8_TARGET_OS_WIN) && !defined(V8_OS_WIN)
#if ABI_USES_FUNCTION_DESCRIPTORS

View File

@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#if defined(V8_OS_STARBOARD)
#include "starboard/system.h"
#define __builtin_abort SbSystemBreakIntoDebugger
#endif
#include "src/inspector/v8-stack-trace-impl.h"
#include <algorithm>

View File

@ -7,6 +7,7 @@
#include "src/objects/fixed-array.h"
#include "src/objects/struct.h"
#include "src/objects/torque-defined-classes.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"

View File

@ -4,6 +4,7 @@
#include "src/regexp/experimental/experimental-bytecode.h"
#include <cctype>
#include <iomanip>
namespace v8 {