Merge V8 5.2.361.47 DO NOT MERGE
https://chromium.googlesource.com/v8/v8/+/5.2.361.47
FPIIM-449
Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index ab436c2..519df77 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -213,7 +213,7 @@
}
accumulator.NextPrototype();
Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter);
- JSObject::CollectOwnElementKeys(current, &accumulator, ALL_PROPERTIES);
+ accumulator.CollectOwnElementIndices(current);
}
// Erase any keys >= length.
Handle<FixedArray> keys = accumulator.GetKeys(KEEP_NUMBERS);
@@ -455,6 +455,15 @@
return isolate->heap()->false_value();
}
+// ES6 22.1.2.2 Array.isArray
+RUNTIME_FUNCTION(Runtime_ArrayIsArray) {
+ HandleScope shs(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
+ Maybe<bool> result = Object::IsArray(object);
+ MAYBE_RETURN(result, isolate->heap()->exception());
+ return isolate->heap()->ToBoolean(result.FromJust());
+}
RUNTIME_FUNCTION(Runtime_IsArray) {
SealHandleScope shs(isolate);
@@ -463,7 +472,6 @@
return isolate->heap()->ToBoolean(obj->IsJSArray());
}
-
RUNTIME_FUNCTION(Runtime_HasCachedArrayIndex) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 1);
diff --git a/src/runtime/runtime-atomics.cc b/src/runtime/runtime-atomics.cc
index 94d98d4..dd309f7 100644
--- a/src/runtime/runtime-atomics.cc
+++ b/src/runtime/runtime-atomics.cc
@@ -33,18 +33,6 @@
}
template <typename T>
-inline T LoadSeqCst(T* p) {
- T result;
- __atomic_load(p, &result, __ATOMIC_SEQ_CST);
- return result;
-}
-
-template <typename T>
-inline void StoreSeqCst(T* p, T value) {
- __atomic_store_n(p, value, __ATOMIC_SEQ_CST);
-}
-
-template <typename T>
inline T AddSeqCst(T* p, T value) {
return __atomic_fetch_add(p, value, __ATOMIC_SEQ_CST);
}
@@ -116,11 +104,6 @@
return InterlockedCompareExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(newval), \
bit_cast<vctype>(oldval)); \
- } \
- inline type LoadSeqCst(type* p) { return *p; } \
- inline void StoreSeqCst(type* p, type value) { \
- InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
- bit_cast<vctype>(value)); \
}
ATOMIC_OPS(int8_t, 8, char)
@@ -216,22 +199,6 @@
template <typename T>
-inline Object* DoLoad(Isolate* isolate, void* buffer, size_t index) {
- T result = LoadSeqCst(static_cast<T*>(buffer) + index);
- return ToObject(isolate, result);
-}
-
-
-template <typename T>
-inline Object* DoStore(Isolate* isolate, void* buffer, size_t index,
- Handle<Object> obj) {
- T value = FromObject<T>(obj);
- StoreSeqCst(static_cast<T*>(buffer) + index, value);
- return *obj;
-}
-
-
-template <typename T>
inline Object* DoAdd(Isolate* isolate, void* buffer, size_t index,
Handle<Object> obj) {
T value = FromObject<T>(obj);
@@ -307,15 +274,6 @@
}
-inline Object* DoStoreUint8Clamped(Isolate* isolate, void* buffer, size_t index,
- Handle<Object> obj) {
- typedef int32_t convert_type;
- uint8_t value = ClampToUint8(FromObject<convert_type>(obj));
- StoreSeqCst(static_cast<uint8_t*>(buffer) + index, value);
- return *obj;
-}
-
-
#define DO_UINT8_CLAMPED_OP(name, op) \
inline Object* Do##name##Uint8Clamped(Isolate* isolate, void* buffer, \
size_t index, Handle<Object> obj) { \
@@ -365,6 +323,29 @@
V(Uint32, uint32, UINT32, uint32_t, 4) \
V(Int32, int32, INT32, int32_t, 4)
+RUNTIME_FUNCTION(Runtime_ThrowNotIntegerSharedTypedArrayError) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate,
+ NewTypeError(MessageTemplate::kNotIntegerSharedTypedArray, value));
+}
+
+RUNTIME_FUNCTION(Runtime_ThrowNotInt32SharedTypedArrayError) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kNotInt32SharedTypedArray, value));
+}
+
+RUNTIME_FUNCTION(Runtime_ThrowInvalidAtomicAccessIndexError) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(0, args.length());
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewRangeError(MessageTemplate::kInvalidAtomicAccessIndex));
+}
RUNTIME_FUNCTION(Runtime_AtomicsCompareExchange) {
HandleScope scope(isolate);
@@ -400,69 +381,6 @@
}
-RUNTIME_FUNCTION(Runtime_AtomicsLoad) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
- CONVERT_SIZE_ARG_CHECKED(index, 1);
- RUNTIME_ASSERT(sta->GetBuffer()->is_shared());
- RUNTIME_ASSERT(index < NumberToSize(isolate, sta->length()));
-
- uint8_t* source = static_cast<uint8_t*>(sta->GetBuffer()->backing_store()) +
- NumberToSize(isolate, sta->byte_offset());
-
- switch (sta->type()) {
-#define TYPED_ARRAY_CASE(Type, typeName, TYPE, ctype, size) \
- case kExternal##Type##Array: \
- return DoLoad<ctype>(isolate, source, index);
-
- INTEGER_TYPED_ARRAYS(TYPED_ARRAY_CASE)
-#undef TYPED_ARRAY_CASE
-
- case kExternalUint8ClampedArray:
- return DoLoad<uint8_t>(isolate, source, index);
-
- default:
- break;
- }
-
- UNREACHABLE();
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_AtomicsStore) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 3);
- CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
- CONVERT_SIZE_ARG_CHECKED(index, 1);
- CONVERT_NUMBER_ARG_HANDLE_CHECKED(value, 2);
- RUNTIME_ASSERT(sta->GetBuffer()->is_shared());
- RUNTIME_ASSERT(index < NumberToSize(isolate, sta->length()));
-
- uint8_t* source = static_cast<uint8_t*>(sta->GetBuffer()->backing_store()) +
- NumberToSize(isolate, sta->byte_offset());
-
- switch (sta->type()) {
-#define TYPED_ARRAY_CASE(Type, typeName, TYPE, ctype, size) \
- case kExternal##Type##Array: \
- return DoStore<ctype>(isolate, source, index, value);
-
- INTEGER_TYPED_ARRAYS(TYPED_ARRAY_CASE)
-#undef TYPED_ARRAY_CASE
-
- case kExternalUint8ClampedArray:
- return DoStoreUint8Clamped(isolate, source, index, value);
-
- default:
- break;
- }
-
- UNREACHABLE();
- return isolate->heap()->undefined_value();
-}
-
-
RUNTIME_FUNCTION(Runtime_AtomicsAdd) {
HandleScope scope(isolate);
DCHECK(args.length() == 3);
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
index 3f10225..a784d6d 100644
--- a/src/runtime/runtime-classes.cc
+++ b/src/runtime/runtime-classes.cc
@@ -194,14 +194,6 @@
}
-RUNTIME_FUNCTION(Runtime_FinalizeClassDefinition) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0);
- JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties");
- return *constructor;
-}
-
static MaybeHandle<Object> LoadFromSuper(Isolate* isolate,
Handle<Object> receiver,
Handle<JSObject> home_object,
diff --git a/src/runtime/runtime-collections.cc b/src/runtime/runtime-collections.cc
index 32340e5..65690df 100644
--- a/src/runtime/runtime-collections.cc
+++ b/src/runtime/runtime-collections.cc
@@ -368,14 +368,5 @@
}
return *isolate->factory()->NewJSArrayWithElements(values);
}
-
-
-RUNTIME_FUNCTION(Runtime_ObservationWeakMapCreate) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 0);
- Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap();
- JSWeakCollection::Initialize(weakmap, isolate);
- return *weakmap;
-}
} // namespace internal
} // namespace v8
diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc
index 89a6fa1..c8fc9e8 100644
--- a/src/runtime/runtime-compiler.cc
+++ b/src/runtime/runtime-compiler.cc
@@ -19,7 +19,7 @@
RUNTIME_FUNCTION(Runtime_CompileLazy) {
HandleScope scope(isolate);
- DCHECK(args.length() == 1);
+ DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
#ifdef DEBUG
@@ -39,10 +39,22 @@
return function->code();
}
+RUNTIME_FUNCTION(Runtime_CompileBaseline) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+ StackLimitCheck check(isolate);
+ if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
+ if (!Compiler::CompileBaseline(function)) {
+ return isolate->heap()->exception();
+ }
+ DCHECK(function->is_compiled());
+ return function->code();
+}
RUNTIME_FUNCTION(Runtime_CompileOptimized_Concurrent) {
HandleScope scope(isolate);
- DCHECK(args.length() == 1);
+ DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
@@ -56,7 +68,7 @@
RUNTIME_FUNCTION(Runtime_CompileOptimized_NotConcurrent) {
HandleScope scope(isolate);
- DCHECK(args.length() == 1);
+ DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
@@ -305,11 +317,10 @@
}
}
-
static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
Handle<SharedFunctionInfo> outer_info,
LanguageMode language_mode,
- int scope_position) {
+ int eval_scope_position, int eval_position) {
Handle<Context> context = Handle<Context>(isolate->context());
Handle<Context> native_context = Handle<Context>(context->native_context());
@@ -331,9 +342,9 @@
static const ParseRestriction restriction = NO_PARSE_RESTRICTION;
Handle<JSFunction> compiled;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
- isolate, compiled,
- Compiler::GetFunctionFromEval(source, outer_info, context, language_mode,
- restriction, scope_position),
+ isolate, compiled, Compiler::GetFunctionFromEval(
+ source, outer_info, context, language_mode,
+ restriction, eval_scope_position, eval_position),
isolate->heap()->exception());
return *compiled;
}
@@ -341,7 +352,7 @@
RUNTIME_FUNCTION(Runtime_ResolvePossiblyDirectEval) {
HandleScope scope(isolate);
- DCHECK(args.length() == 5);
+ DCHECK(args.length() == 6);
Handle<Object> callee = args.at<Object>(0);
@@ -362,7 +373,7 @@
Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
isolate);
return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
- language_mode, args.smi_at(4));
+ language_mode, args.smi_at(4), args.smi_at(5));
}
} // namespace internal
} // namespace v8
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index ad8375a..e3f3beb 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -42,6 +42,9 @@
JavaScriptFrameIterator it(isolate);
isolate->debug()->Break(it.frame());
+ // If live-edit has dropped frames, we are not going back to dispatch.
+ if (LiveEdit::SetAfterBreakTarget(isolate->debug())) return Smi::FromInt(0);
+
// Return the handler from the original bytecode array.
DCHECK(it.frame()->is_interpreted());
InterpretedFrame* interpreted_frame =
@@ -244,7 +247,7 @@
Handle<JSObject> promise = Handle<JSObject>::cast(object);
Handle<Object> status_obj =
- DebugGetProperty(promise, isolate->factory()->promise_status_symbol());
+ DebugGetProperty(promise, isolate->factory()->promise_state_symbol());
RUNTIME_ASSERT_HANDLIFIED(status_obj->IsSmi(), JSArray);
const char* status = "rejected";
int status_val = Handle<Smi>::cast(status_obj)->value();
@@ -267,12 +270,31 @@
result->set(1, *status_str);
Handle<Object> value_obj =
- DebugGetProperty(promise, isolate->factory()->promise_value_symbol());
+ DebugGetProperty(promise, isolate->factory()->promise_result_symbol());
Handle<String> promise_value =
factory->NewStringFromAsciiChecked("[[PromiseValue]]");
result->set(2, *promise_value);
result->set(3, *value_obj);
return factory->NewJSArrayWithElements(result);
+ } else if (object->IsJSProxy()) {
+ Handle<JSProxy> js_proxy = Handle<JSProxy>::cast(object);
+ Handle<FixedArray> result = factory->NewFixedArray(3 * 2);
+
+ Handle<String> handler_str =
+ factory->NewStringFromAsciiChecked("[[Handler]]");
+ result->set(0, *handler_str);
+ result->set(1, js_proxy->handler());
+
+ Handle<String> target_str =
+ factory->NewStringFromAsciiChecked("[[Target]]");
+ result->set(2, *target_str);
+ result->set(3, js_proxy->target());
+
+ Handle<String> is_revoked_str =
+ factory->NewStringFromAsciiChecked("[[IsRevoked]]");
+ result->set(4, *is_revoked_str);
+ result->set(5, isolate->heap()->ToBoolean(js_proxy->IsRevoked()));
+ return factory->NewJSArrayWithElements(result);
} else if (object->IsJSValue()) {
Handle<JSValue> js_value = Handle<JSValue>::cast(object);
@@ -339,7 +361,7 @@
return *isolate->factory()->NewJSArrayWithElements(details);
}
- LookupIterator it(obj, name, LookupIterator::HIDDEN);
+ LookupIterator it(obj, name, LookupIterator::OWN);
bool has_caught = false;
Handle<Object> value = DebugGetProperty(&it, &has_caught);
if (!it.IsFound()) return isolate->heap()->undefined_value();
@@ -410,50 +432,6 @@
}
-// Return the property insertion index calculated from the property details.
-// args[0]: smi with property details.
-RUNTIME_FUNCTION(Runtime_DebugPropertyIndexFromDetails) {
- SealHandleScope shs(isolate);
- DCHECK(args.length() == 1);
- CONVERT_PROPERTY_DETAILS_CHECKED(details, 0);
- // TODO(verwaest): Works only for dictionary mode holders.
- return Smi::FromInt(details.dictionary_index());
-}
-
-
-// Return property value from named interceptor.
-// args[0]: object
-// args[1]: property name
-RUNTIME_FUNCTION(Runtime_DebugNamedInterceptorPropertyValue) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
- RUNTIME_ASSERT(obj->HasNamedInterceptor());
- CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
-
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
- JSObject::GetProperty(obj, name));
- return *result;
-}
-
-
-// Return element value from indexed interceptor.
-// args[0]: object
-// args[1]: index
-RUNTIME_FUNCTION(Runtime_DebugIndexedInterceptorElementValue) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
- RUNTIME_ASSERT(obj->HasIndexedInterceptor());
- CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, JSReceiver::GetElement(isolate, obj, index));
- return *result;
-}
-
-
RUNTIME_FUNCTION(Runtime_CheckExecutionState) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 1);
@@ -571,7 +549,9 @@
for (int slot = 0; slot < scope_info->LocalCount(); ++slot) {
// Hide compiler-introduced temporary variables, whether on the stack or on
// the context.
- if (scope_info->LocalIsSynthetic(slot)) local_count--;
+ if (ScopeInfo::VariableIsSynthetic(scope_info->LocalName(slot))) {
+ local_count--;
+ }
}
Handle<FixedArray> locals =
@@ -582,7 +562,7 @@
int i = 0;
for (; i < scope_info->StackLocalCount(); ++i) {
// Use the value from the stack.
- if (scope_info->LocalIsSynthetic(i)) continue;
+ if (ScopeInfo::VariableIsSynthetic(scope_info->LocalName(i))) continue;
locals->set(local * 2, scope_info->LocalName(i));
Handle<Object> value = frame_inspector.GetExpression(i);
// TODO(yangguo): We convert optimized out values to {undefined} when they
@@ -596,8 +576,8 @@
Handle<Context> context(
Handle<Context>::cast(frame_inspector.GetContext())->closure_context());
for (; i < scope_info->LocalCount(); ++i) {
- if (scope_info->LocalIsSynthetic(i)) continue;
Handle<String> name(scope_info->LocalName(i));
+ if (ScopeInfo::VariableIsSynthetic(*name)) continue;
VariableMode mode;
InitializationFlag init_flag;
MaybeAssignedFlag maybe_assigned_flag;
@@ -958,78 +938,6 @@
}
-RUNTIME_FUNCTION(Runtime_GetThreadCount) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
- RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id));
-
- // Count all archived V8 threads.
- int n = 0;
- for (ThreadState* thread = isolate->thread_manager()->FirstThreadStateInUse();
- thread != NULL; thread = thread->Next()) {
- n++;
- }
-
- // Total number of threads is current thread and archived threads.
- return Smi::FromInt(n + 1);
-}
-
-
-static const int kThreadDetailsCurrentThreadIndex = 0;
-static const int kThreadDetailsThreadIdIndex = 1;
-static const int kThreadDetailsSize = 2;
-
-// Return an array with thread details
-// args[0]: number: break id
-// args[1]: number: thread index
-//
-// The array returned contains the following information:
-// 0: Is current thread?
-// 1: Thread id
-RUNTIME_FUNCTION(Runtime_GetThreadDetails) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
- RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id));
-
- CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
-
- // Allocate array for result.
- Handle<FixedArray> details =
- isolate->factory()->NewFixedArray(kThreadDetailsSize);
-
- // Thread index 0 is current thread.
- if (index == 0) {
- // Fill the details.
- details->set(kThreadDetailsCurrentThreadIndex,
- isolate->heap()->true_value());
- details->set(kThreadDetailsThreadIdIndex,
- Smi::FromInt(ThreadId::Current().ToInteger()));
- } else {
- // Find the thread with the requested index.
- int n = 1;
- ThreadState* thread = isolate->thread_manager()->FirstThreadStateInUse();
- while (index != n && thread != NULL) {
- thread = thread->Next();
- n++;
- }
- if (thread == NULL) {
- return isolate->heap()->undefined_value();
- }
-
- // Fill the details.
- details->set(kThreadDetailsCurrentThreadIndex,
- isolate->heap()->false_value());
- details->set(kThreadDetailsThreadIdIndex,
- Smi::FromInt(thread->id().ToInteger()));
- }
-
- // Convert to JS array and return.
- return *isolate->factory()->NewJSArrayWithElements(details);
-}
-
-
// Sets the disable break state
// args[0]: disable break state
RUNTIME_FUNCTION(Runtime_SetBreakPointsActive) {
@@ -1292,10 +1200,7 @@
}
// Return result as a JS array.
- Handle<JSObject> result =
- isolate->factory()->NewJSObject(isolate->array_function());
- JSArray::SetContent(Handle<JSArray>::cast(result), instances);
- return *result;
+ return *isolate->factory()->NewJSArrayWithElements(instances);
}
static bool HasInPrototypeChainIgnoringProxies(Isolate* isolate,
@@ -1454,11 +1359,14 @@
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
+ Handle<Object> name;
if (function->IsJSBoundFunction()) {
- return Handle<JSBoundFunction>::cast(function)->name();
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, name, JSBoundFunction::GetName(
+ isolate, Handle<JSBoundFunction>::cast(function)));
+ } else {
+ name = JSFunction::GetDebugName(Handle<JSFunction>::cast(function));
}
- Handle<Object> name =
- JSFunction::GetDebugName(Handle<JSFunction>::cast(function));
return *name;
}
@@ -1598,18 +1506,9 @@
// built-in function such as Array.forEach to enable stepping into the callback,
// if we are indeed stepping and the callback is subject to debugging.
RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) {
- DCHECK(args.length() == 1);
HandleScope scope(isolate);
- CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
- RUNTIME_ASSERT(object->IsJSFunction() || object->IsJSGeneratorObject());
- Handle<JSFunction> fun;
- if (object->IsJSFunction()) {
- fun = Handle<JSFunction>::cast(object);
- } else {
- fun = Handle<JSFunction>(
- Handle<JSGeneratorObject>::cast(object)->function(), isolate);
- }
-
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
isolate->debug()->PrepareStepIn(fun);
return isolate->heap()->undefined_value();
}
diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc
index 011f9ff..56cf3b6 100644
--- a/src/runtime/runtime-function.cc
+++ b/src/runtime/runtime-function.cc
@@ -11,6 +11,7 @@
#include "src/isolate-inl.h"
#include "src/messages.h"
#include "src/profiler/cpu-profiler.h"
+#include "src/wasm/wasm-module.h"
namespace v8 {
namespace internal {
@@ -20,16 +21,15 @@
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
- if (function->IsJSBoundFunction()) {
Handle<Object> result;
+ if (function->IsJSBoundFunction()) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, JSBoundFunction::GetName(
isolate, Handle<JSBoundFunction>::cast(function)));
- return *result;
} else {
- RUNTIME_ASSERT(function->IsJSFunction());
- return Handle<JSFunction>::cast(function)->shared()->name();
+ result = JSFunction::GetName(isolate, Handle<JSFunction>::cast(function));
}
+ return *result;
}
@@ -289,10 +289,7 @@
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
- if (receiver->IsNull() || receiver->IsUndefined()) {
- return isolate->global_proxy();
- }
- return *Object::ToObject(isolate, receiver).ToHandleChecked();
+ return *Object::ConvertReceiver(isolate, receiver).ToHandleChecked();
}
@@ -314,5 +311,15 @@
: *JSFunction::ToString(Handle<JSFunction>::cast(function));
}
+RUNTIME_FUNCTION(Runtime_WasmGetFunctionName) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, wasm, 0);
+ CONVERT_SMI_ARG_CHECKED(func_index, 1);
+
+ return *wasm::GetWasmFunctionName(wasm, func_index);
+}
+
} // namespace internal
} // namespace v8
diff --git a/src/runtime/runtime-generator.cc b/src/runtime/runtime-generator.cc
index 181b5f9..7ff7fc8 100644
--- a/src/runtime/runtime-generator.cc
+++ b/src/runtime/runtime-generator.cc
@@ -14,22 +14,27 @@
RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) {
HandleScope scope(isolate);
- DCHECK(args.length() == 0);
+ DCHECK(args.length() == 2);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
+ RUNTIME_ASSERT(function->shared()->is_resumable());
- JavaScriptFrameIterator it(isolate);
- JavaScriptFrame* frame = it.frame();
- Handle<JSFunction> function(frame->function());
- RUNTIME_ASSERT(function->shared()->is_generator());
+ Handle<FixedArray> operand_stack;
+ if (FLAG_ignition && FLAG_ignition_generators) {
+ int size = function->shared()->bytecode_array()->register_count();
+ operand_stack = isolate->factory()->NewFixedArray(size);
+ } else {
+ DCHECK(!function->shared()->HasBytecodeArray());
+ operand_stack = handle(isolate->heap()->empty_fixed_array());
+ }
- Handle<JSGeneratorObject> generator;
- DCHECK(!frame->IsConstructor());
- generator = isolate->factory()->NewJSGeneratorObject(function);
+ Handle<JSGeneratorObject> generator =
+ isolate->factory()->NewJSGeneratorObject(function);
generator->set_function(*function);
- generator->set_context(Context::cast(frame->context()));
- generator->set_receiver(frame->receiver());
- generator->set_continuation(0);
- generator->set_operand_stack(isolate->heap()->empty_fixed_array());
-
+ generator->set_context(isolate->context());
+ generator->set_receiver(*receiver);
+ generator->set_operand_stack(*operand_stack);
+ generator->set_continuation(JSGeneratorObject::kGeneratorExecuting);
return *generator;
}
@@ -41,7 +46,7 @@
JavaScriptFrameIterator stack_iterator(isolate);
JavaScriptFrame* frame = stack_iterator.frame();
- RUNTIME_ASSERT(frame->function()->shared()->is_generator());
+ RUNTIME_ASSERT(frame->function()->shared()->is_resumable());
DCHECK_EQ(frame->function(), generator_object->function());
DCHECK(frame->function()->shared()->is_compiled());
DCHECK(!frame->function()->IsOptimized());
@@ -73,62 +78,6 @@
}
-// Note that this function is the slow path for resuming generators. It is only
-// called if the suspended activation had operands on the stack, stack handlers
-// needing rewinding, or if the resume should throw an exception. The fast path
-// is handled directly in FullCodeGenerator::EmitGeneratorResume(), which is
-// inlined into GeneratorNext, GeneratorReturn, and GeneratorThrow.
-// EmitGeneratorResume is called in any case, as it needs to reconstruct the
-// stack frame and make space for arguments and operands.
-RUNTIME_FUNCTION(Runtime_ResumeJSGeneratorObject) {
- SealHandleScope shs(isolate);
- DCHECK(args.length() == 3);
- CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0);
- CONVERT_ARG_CHECKED(Object, value, 1);
- CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2);
- JavaScriptFrameIterator stack_iterator(isolate);
- JavaScriptFrame* frame = stack_iterator.frame();
-
- DCHECK_EQ(frame->function(), generator_object->function());
- DCHECK(frame->function()->shared()->is_compiled());
- DCHECK(!frame->function()->IsOptimized());
-
- STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting < 0);
- STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed == 0);
-
- Code* code = generator_object->function()->shared()->code();
- int offset = generator_object->continuation();
- DCHECK_GT(offset, 0);
- frame->set_pc(code->instruction_start() + offset);
- if (FLAG_enable_embedded_constant_pool) {
- frame->set_constant_pool(code->constant_pool());
- }
- generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting);
-
- FixedArray* operand_stack = generator_object->operand_stack();
- int operands_count = operand_stack->length();
- if (operands_count != 0) {
- frame->RestoreOperandStack(operand_stack);
- generator_object->set_operand_stack(isolate->heap()->empty_fixed_array());
- }
-
- JSGeneratorObject::ResumeMode resume_mode =
- static_cast<JSGeneratorObject::ResumeMode>(resume_mode_int);
- switch (resume_mode) {
- // Note: this looks like NEXT and RETURN are the same but RETURN receives
- // special treatment in the generator code (to which we return here).
- case JSGeneratorObject::NEXT:
- case JSGeneratorObject::RETURN:
- return value;
- case JSGeneratorObject::THROW:
- return isolate->Throw(value);
- }
-
- UNREACHABLE();
- return isolate->ThrowIllegalOperation();
-}
-
-
RUNTIME_FUNCTION(Runtime_GeneratorClose) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
@@ -170,7 +119,26 @@
}
-// Returns generator continuation as a PC offset, or the magic -1 or 0 values.
+// Returns resume mode of generator activation.
+RUNTIME_FUNCTION(Runtime_GeneratorGetResumeMode) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
+
+ return Smi::FromInt(generator->resume_mode());
+}
+
+
+RUNTIME_FUNCTION(Runtime_GeneratorSetContext) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
+
+ generator->set_context(isolate->context());
+ return isolate->heap()->undefined_value();
+}
+
+
RUNTIME_FUNCTION(Runtime_GeneratorGetContinuation) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
@@ -180,6 +148,45 @@
}
+RUNTIME_FUNCTION(Runtime_GeneratorSetContinuation) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 2);
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
+ CONVERT_SMI_ARG_CHECKED(continuation, 1);
+
+ generator->set_continuation(continuation);
+ return isolate->heap()->undefined_value();
+}
+
+
+RUNTIME_FUNCTION(Runtime_GeneratorLoadRegister) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 2);
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
+ CONVERT_SMI_ARG_CHECKED(index, 1);
+
+ DCHECK(FLAG_ignition && FLAG_ignition_generators);
+ DCHECK(generator->function()->shared()->HasBytecodeArray());
+
+ return generator->operand_stack()->get(index);
+}
+
+
+RUNTIME_FUNCTION(Runtime_GeneratorStoreRegister) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 3);
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
+ CONVERT_SMI_ARG_CHECKED(index, 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
+
+ DCHECK(FLAG_ignition && FLAG_ignition_generators);
+ DCHECK(generator->function()->shared()->HasBytecodeArray());
+
+ generator->operand_stack()->set(index, *value);
+ return isolate->heap()->undefined_value();
+}
+
+
RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
@@ -195,23 +202,5 @@
return isolate->heap()->undefined_value();
}
-// Optimization for builtins calling any of the following three functions is
-// disabled in js/generator.js and compiler.cc, hence they are unreachable.
-
-RUNTIME_FUNCTION(Runtime_GeneratorNext) {
- UNREACHABLE();
- return nullptr;
-}
-
-RUNTIME_FUNCTION(Runtime_GeneratorReturn) {
- UNREACHABLE();
- return nullptr;
-}
-
-RUNTIME_FUNCTION(Runtime_GeneratorThrow) {
- UNREACHABLE();
- return nullptr;
-}
-
} // namespace internal
} // namespace v8
diff --git a/src/runtime/runtime-i18n.cc b/src/runtime/runtime-i18n.cc
index 27f970b..14974e8 100644
--- a/src/runtime/runtime-i18n.cc
+++ b/src/runtime/runtime-i18n.cc
@@ -24,21 +24,42 @@
#include "unicode/dtfmtsym.h"
#include "unicode/dtptngen.h"
#include "unicode/locid.h"
+#include "unicode/normalizer2.h"
#include "unicode/numfmt.h"
#include "unicode/numsys.h"
#include "unicode/rbbi.h"
#include "unicode/smpdtfmt.h"
#include "unicode/timezone.h"
+#include "unicode/translit.h"
#include "unicode/uchar.h"
#include "unicode/ucol.h"
#include "unicode/ucurr.h"
#include "unicode/uloc.h"
+#include "unicode/unistr.h"
#include "unicode/unum.h"
#include "unicode/uversion.h"
namespace v8 {
namespace internal {
+namespace {
+
+const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat,
+ base::SmartArrayPointer<uc16>* dest,
+ int32_t length) {
+ DCHECK(flat.IsFlat());
+ if (flat.IsOneByte()) {
+ if (dest->is_empty()) {
+ dest->Reset(NewArray<uc16>(length));
+ CopyChars(dest->get(), flat.ToOneByteVector().start(), length);
+ }
+ return reinterpret_cast<const UChar*>(dest->get());
+ } else {
+ return reinterpret_cast<const UChar*>(flat.ToUC16Vector().start());
+ }
+}
+
+} // namespace
RUNTIME_FUNCTION(Runtime_CanonicalizeLanguageTag) {
HandleScope scope(isolate);
@@ -336,9 +357,9 @@
// Make object handle weak so we can delete the data format once GC kicks in.
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
- GlobalHandles::MakeWeak(wrapper.location(),
- reinterpret_cast<void*>(wrapper.location()),
- DateFormat::DeleteDateFormat);
+ GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
+ DateFormat::DeleteDateFormat,
+ WeakCallbackType::kInternalFields);
return *local_object;
}
@@ -430,9 +451,9 @@
JSObject::AddProperty(local_object, key, value, NONE);
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
- GlobalHandles::MakeWeak(wrapper.location(),
- reinterpret_cast<void*>(wrapper.location()),
- NumberFormat::DeleteNumberFormat);
+ GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
+ NumberFormat::DeleteNumberFormat,
+ WeakCallbackType::kInternalFields);
return *local_object;
}
@@ -536,9 +557,9 @@
JSObject::AddProperty(local_object, key, value, NONE);
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
- GlobalHandles::MakeWeak(wrapper.location(),
- reinterpret_cast<void*>(wrapper.location()),
- Collator::DeleteCollator);
+ GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
+ Collator::DeleteCollator,
+ WeakCallbackType::kInternalFields);
return *local_object;
}
@@ -555,14 +576,20 @@
icu::Collator* collator = Collator::UnpackCollator(isolate, collator_holder);
if (!collator) return isolate->ThrowIllegalOperation();
- v8::String::Value string_value1(v8::Utils::ToLocal(string1));
- v8::String::Value string_value2(v8::Utils::ToLocal(string2));
- const UChar* u_string1 = reinterpret_cast<const UChar*>(*string_value1);
- const UChar* u_string2 = reinterpret_cast<const UChar*>(*string_value2);
+ string1 = String::Flatten(string1);
+ string2 = String::Flatten(string2);
+ DisallowHeapAllocation no_gc;
+ int32_t length1 = string1->length();
+ int32_t length2 = string2->length();
+ String::FlatContent flat1 = string1->GetFlatContent();
+ String::FlatContent flat2 = string2->GetFlatContent();
+ base::SmartArrayPointer<uc16> sap1;
+ base::SmartArrayPointer<uc16> sap2;
+ const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1);
+ const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2);
UErrorCode status = U_ZERO_ERROR;
UCollationResult result =
- collator->compare(u_string1, string_value1.length(), u_string2,
- string_value2.length(), status);
+ collator->compare(string_val1, length1, string_val2, length2, status);
if (U_FAILURE(status)) return isolate->ThrowIllegalOperation();
return *isolate->factory()->NewNumberFromInt(result);
@@ -571,25 +598,51 @@
RUNTIME_FUNCTION(Runtime_StringNormalize) {
HandleScope scope(isolate);
- static const UNormalizationMode normalizationForms[] = {
- UNORM_NFC, UNORM_NFD, UNORM_NFKC, UNORM_NFKD};
+ static const struct {
+ const char* name;
+ UNormalization2Mode mode;
+ } normalizationForms[] = {
+ {"nfc", UNORM2_COMPOSE},
+ {"nfc", UNORM2_DECOMPOSE},
+ {"nfkc", UNORM2_COMPOSE},
+ {"nfkc", UNORM2_DECOMPOSE},
+ };
DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(String, stringValue, 0);
+ CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
CONVERT_NUMBER_CHECKED(int, form_id, Int32, args[1]);
RUNTIME_ASSERT(form_id >= 0 &&
static_cast<size_t>(form_id) < arraysize(normalizationForms));
- v8::String::Value string_value(v8::Utils::ToLocal(stringValue));
- const UChar* u_value = reinterpret_cast<const UChar*>(*string_value);
-
- // TODO(mnita): check Normalizer2 (not available in ICU 46)
- UErrorCode status = U_ZERO_ERROR;
- icu::UnicodeString input(false, u_value, string_value.length());
+ int length = s->length();
+ s = String::Flatten(s);
icu::UnicodeString result;
- icu::Normalizer::normalize(input, normalizationForms[form_id], 0, result,
- status);
+ base::SmartArrayPointer<uc16> sap;
+ UErrorCode status = U_ZERO_ERROR;
+ {
+ DisallowHeapAllocation no_gc;
+ String::FlatContent flat = s->GetFlatContent();
+ const UChar* src = GetUCharBufferFromFlat(flat, &sap, length);
+ icu::UnicodeString input(false, src, length);
+ // Getting a singleton. Should not free it.
+ const icu::Normalizer2* normalizer =
+ icu::Normalizer2::getInstance(nullptr, normalizationForms[form_id].name,
+ normalizationForms[form_id].mode, status);
+ DCHECK(U_SUCCESS(status));
+ RUNTIME_ASSERT(normalizer != nullptr);
+ int32_t normalized_prefix_length =
+ normalizer->spanQuickCheckYes(input, status);
+ // Quick return if the input is already normalized.
+ if (length == normalized_prefix_length) return *s;
+ icu::UnicodeString unnormalized =
+ input.tempSubString(normalized_prefix_length);
+ // Read-only alias of the normalized prefix.
+ result.setTo(false, input.getBuffer(), normalized_prefix_length);
+ // copy-on-write; normalize the suffix and append to |result|.
+ normalizer->normalizeSecondAndAppend(result, unnormalized, status);
+ }
+
if (U_FAILURE(status)) {
return isolate->heap()->undefined_value();
}
@@ -640,9 +693,9 @@
// Make object handle weak so we can delete the break iterator once GC kicks
// in.
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
- GlobalHandles::MakeWeak(wrapper.location(),
- reinterpret_cast<void*>(wrapper.location()),
- BreakIterator::DeleteBreakIterator);
+ GlobalHandles::MakeWeak(wrapper.location(), wrapper.location(),
+ BreakIterator::DeleteBreakIterator,
+ WeakCallbackType::kInternalFields);
return *local_object;
}
@@ -663,9 +716,13 @@
break_iterator_holder->GetInternalField(1));
delete u_text;
- v8::String::Value text_value(v8::Utils::ToLocal(text));
- u_text = new icu::UnicodeString(reinterpret_cast<const UChar*>(*text_value),
- text_value.length());
+ int length = text->length();
+ text = String::Flatten(text);
+ DisallowHeapAllocation no_gc;
+ String::FlatContent flat = text->GetFlatContent();
+ base::SmartArrayPointer<uc16> sap;
+ const UChar* text_value = GetUCharBufferFromFlat(flat, &sap, length);
+ u_text = new icu::UnicodeString(text_value, length);
break_iterator_holder->SetInternalField(1, reinterpret_cast<Smi*>(u_text));
break_iterator->setText(*u_text);
@@ -749,6 +806,345 @@
return *isolate->factory()->NewStringFromStaticChars("unknown");
}
}
+
+namespace {
+void ConvertCaseWithTransliterator(icu::UnicodeString* input,
+ const char* transliterator_id) {
+ UErrorCode status = U_ZERO_ERROR;
+ base::SmartPointer<icu::Transliterator> translit(
+ icu::Transliterator::createInstance(
+ icu::UnicodeString(transliterator_id, -1, US_INV), UTRANS_FORWARD,
+ status));
+ if (U_FAILURE(status)) return;
+ translit->transliterate(*input);
+}
+
+MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate,
+ bool is_to_upper, const char* lang) {
+ int32_t src_length = s->length();
+
+ // Greek uppercasing has to be done via transliteration.
+ // TODO(jshin): Drop this special-casing once ICU's regular case conversion
+ // API supports Greek uppercasing. See
+ // http://bugs.icu-project.org/trac/ticket/10582 .
+ // In the meantime, if there's no Greek character in |s|, call this
+ // function again with the root locale (lang="").
+ // ICU's C API for transliteration is nasty and we just use C++ API.
+ if (V8_UNLIKELY(is_to_upper && lang[0] == 'e' && lang[1] == 'l')) {
+ icu::UnicodeString converted;
+ base::SmartArrayPointer<uc16> sap;
+ {
+ DisallowHeapAllocation no_gc;
+ String::FlatContent flat = s->GetFlatContent();
+ const UChar* src = GetUCharBufferFromFlat(flat, &sap, src_length);
+ // Starts with the source string (read-only alias with copy-on-write
+ // semantics) and will be modified to contain the converted result.
+ // Using read-only alias at first saves one copy operation if
+ // transliteration does not change the input, which is rather rare.
+ // Moreover, transliteration takes rather long so that saving one copy
+ // helps only a little bit.
+ converted.setTo(false, src, src_length);
+ ConvertCaseWithTransliterator(&converted, "el-Upper");
+ // If no change is made, just return |s|.
+ if (converted.getBuffer() == src) return *s;
+ }
+ Handle<String> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>(
+ reinterpret_cast<const uint16_t*>(converted.getBuffer()),
+ converted.length())));
+ return *result;
+ }
+
+ auto case_converter = is_to_upper ? u_strToUpper : u_strToLower;
+
+ int32_t dest_length = src_length;
+ UErrorCode status;
+ Handle<SeqTwoByteString> result;
+ base::SmartArrayPointer<uc16> sap;
+
+ // This is not a real loop. It'll be executed only once (no overflow) or
+ // twice (overflow).
+ for (int i = 0; i < 2; ++i) {
+ result =
+ isolate->factory()->NewRawTwoByteString(dest_length).ToHandleChecked();
+ DisallowHeapAllocation no_gc;
+ String::FlatContent flat = s->GetFlatContent();
+ const UChar* src = GetUCharBufferFromFlat(flat, &sap, src_length);
+ status = U_ZERO_ERROR;
+ dest_length = case_converter(reinterpret_cast<UChar*>(result->GetChars()),
+ dest_length, src, src_length, lang, &status);
+ if (status != U_BUFFER_OVERFLOW_ERROR) break;
+ }
+
+ // In most cases, the output will fill the destination buffer completely
+ // leading to an unterminated string (U_STRING_NOT_TERMINATED_WARNING).
+ // Only in rare cases, it'll be shorter than the destination buffer and
+ // |result| has to be truncated.
+ DCHECK(U_SUCCESS(status));
+ if (V8_LIKELY(status == U_STRING_NOT_TERMINATED_WARNING)) {
+ DCHECK(dest_length == result->length());
+ return *result;
+ }
+ if (U_SUCCESS(status)) {
+ DCHECK(dest_length < result->length());
+ return *Handle<SeqTwoByteString>::cast(
+ SeqString::Truncate(result, dest_length));
+ }
+ return *s;
+}
+
+inline bool IsASCIIUpper(uint16_t ch) { return ch >= 'A' && ch <= 'Z'; }
+
+const uint8_t kToLower[256] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
+ 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73,
+ 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
+ 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83,
+ 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B,
+ 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
+ 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
+ 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB,
+ 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xD7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3,
+ 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB,
+ 0xFC, 0xFD, 0xFE, 0xFF,
+};
+
+inline uint16_t ToLatin1Lower(uint16_t ch) {
+ return static_cast<uint16_t>(kToLower[ch]);
+}
+
+inline uint16_t ToASCIIUpper(uint16_t ch) {
+ return ch & ~((ch >= 'a' && ch <= 'z') << 5);
+}
+
+// Does not work for U+00DF (sharp-s), U+00B5 (micron), U+00FF.
+inline uint16_t ToLatin1Upper(uint16_t ch) {
+ DCHECK(ch != 0xDF && ch != 0xB5 && ch != 0xFF);
+ return ch &
+ ~(((ch >= 'a' && ch <= 'z') || (((ch & 0xE0) == 0xE0) && ch != 0xE7))
+ << 5);
+}
+
+template <typename Char>
+bool ToUpperFastASCII(const Vector<const Char>& src,
+ Handle<SeqOneByteString> result) {
+ // Do a faster loop for the case where all the characters are ASCII.
+ uint16_t ored = 0;
+ int32_t index = 0;
+ for (auto it = src.begin(); it != src.end(); ++it) {
+ uint16_t ch = static_cast<uint16_t>(*it);
+ ored |= ch;
+ result->SeqOneByteStringSet(index++, ToASCIIUpper(ch));
+ }
+ return !(ored & ~0x7F);
+}
+
+const uint16_t sharp_s = 0xDF;
+
+template <typename Char>
+bool ToUpperOneByte(const Vector<const Char>& src,
+ Handle<SeqOneByteString> result, int* sharp_s_count) {
+ // Still pretty-fast path for the input with non-ASCII Latin-1 characters.
+
+ // There are two special cases.
+ // 1. U+00B5 and U+00FF are mapped to a character beyond U+00FF.
+ // 2. Lower case sharp-S converts to "SS" (two characters)
+ *sharp_s_count = 0;
+ int32_t index = 0;
+ for (auto it = src.begin(); it != src.end(); ++it) {
+ uint16_t ch = static_cast<uint16_t>(*it);
+ if (V8_UNLIKELY(ch == sharp_s)) {
+ ++(*sharp_s_count);
+ continue;
+ }
+ if (V8_UNLIKELY(ch == 0xB5 || ch == 0xFF)) {
+ // Since this upper-cased character does not fit in an 8-bit string, we
+ // need to take the 16-bit path.
+ return false;
+ }
+ result->SeqOneByteStringSet(index++, ToLatin1Upper(ch));
+ }
+
+ return true;
+}
+
+template <typename Char>
+void ToUpperWithSharpS(const Vector<const Char>& src,
+ Handle<SeqOneByteString> result) {
+ int32_t dest_index = 0;
+ for (auto it = src.begin(); it != src.end(); ++it) {
+ uint16_t ch = static_cast<uint16_t>(*it);
+ if (ch == sharp_s) {
+ result->SeqOneByteStringSet(dest_index++, 'S');
+ result->SeqOneByteStringSet(dest_index++, 'S');
+ } else {
+ result->SeqOneByteStringSet(dest_index++, ToLatin1Upper(ch));
+ }
+ }
+}
+
+} // namespace
+
+RUNTIME_FUNCTION(Runtime_StringToLowerCaseI18N) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(args.length(), 1);
+ CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
+
+ int length = s->length();
+ s = String::Flatten(s);
+ // First scan the string for uppercase and non-ASCII characters:
+ if (s->HasOnlyOneByteChars()) {
+ unsigned first_index_to_lower = length;
+ for (int index = 0; index < length; ++index) {
+ // Blink specializes this path for one-byte strings, so it
+ // does not need to do a generic get, but can do the equivalent
+ // of SeqOneByteStringGet.
+ uint16_t ch = s->Get(index);
+ if (V8_UNLIKELY(IsASCIIUpper(ch) || ch & ~0x7F)) {
+ first_index_to_lower = index;
+ break;
+ }
+ }
+
+ // Nothing to do if the string is all ASCII with no uppercase.
+ if (first_index_to_lower == length) return *s;
+
+ // We depend here on the invariant that the length of a Latin1
+ // string is invariant under ToLowerCase, and the result always
+ // fits in the Latin1 range in the *root locale*. It does not hold
+ // for ToUpperCase even in the root locale.
+ Handle<SeqOneByteString> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result, isolate->factory()->NewRawOneByteString(length));
+
+ DisallowHeapAllocation no_gc;
+ String::FlatContent flat = s->GetFlatContent();
+ if (flat.IsOneByte()) {
+ const uint8_t* src = flat.ToOneByteVector().start();
+ CopyChars(result->GetChars(), src, first_index_to_lower);
+ for (int index = first_index_to_lower; index < length; ++index) {
+ uint16_t ch = static_cast<uint16_t>(src[index]);
+ result->SeqOneByteStringSet(index, ToLatin1Lower(ch));
+ }
+ } else {
+ const uint16_t* src = flat.ToUC16Vector().start();
+ CopyChars(result->GetChars(), src, first_index_to_lower);
+ for (int index = first_index_to_lower; index < length; ++index) {
+ uint16_t ch = src[index];
+ result->SeqOneByteStringSet(index, ToLatin1Lower(ch));
+ }
+ }
+
+ return *result;
+ }
+
+ // Blink had an additional case here for ASCII 2-byte strings, but
+ // that is subsumed by the above code (assuming there isn't a false
+ // negative for HasOnlyOneByteChars).
+
+ // Do a slower implementation for cases that include non-ASCII characters.
+ return LocaleConvertCase(s, isolate, false, "");
+}
+
+RUNTIME_FUNCTION(Runtime_StringToUpperCaseI18N) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(args.length(), 1);
+ CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
+
+ // This function could be optimized for no-op cases the way lowercase
+ // counterpart is, but in empirical testing, few actual calls to upper()
+ // are no-ops. So, it wouldn't be worth the extra time for pre-scanning.
+
+ int32_t length = s->length();
+ s = String::Flatten(s);
+
+ if (s->HasOnlyOneByteChars()) {
+ Handle<SeqOneByteString> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result, isolate->factory()->NewRawOneByteString(length));
+
+ int sharp_s_count;
+ bool is_result_single_byte;
+ {
+ DisallowHeapAllocation no_gc;
+ String::FlatContent flat = s->GetFlatContent();
+ // If it was ok to slow down ASCII-only input slightly, ToUpperFastASCII
+ // could be removed because ToUpperOneByte is pretty fast now (it
+ // does not call ICU API any more.).
+ if (flat.IsOneByte()) {
+ Vector<const uint8_t> src = flat.ToOneByteVector();
+ if (ToUpperFastASCII(src, result)) return *result;
+ is_result_single_byte = ToUpperOneByte(src, result, &sharp_s_count);
+ } else {
+ DCHECK(flat.IsTwoByte());
+ Vector<const uint16_t> src = flat.ToUC16Vector();
+ if (ToUpperFastASCII(src, result)) return *result;
+ is_result_single_byte = ToUpperOneByte(src, result, &sharp_s_count);
+ }
+ }
+
+ // Go to the full Unicode path if there are characters whose uppercase
+ // is beyond the Latin-1 range (cannot be represented in OneByteString).
+ if (V8_UNLIKELY(!is_result_single_byte)) {
+ return LocaleConvertCase(s, isolate, true, "");
+ }
+
+ if (sharp_s_count == 0) return *result;
+
+ // We have sharp_s_count sharp-s characters, but the result is still
+ // in the Latin-1 range.
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ isolate->factory()->NewRawOneByteString(length + sharp_s_count));
+ DisallowHeapAllocation no_gc;
+ String::FlatContent flat = s->GetFlatContent();
+ if (flat.IsOneByte()) {
+ ToUpperWithSharpS(flat.ToOneByteVector(), result);
+ } else {
+ ToUpperWithSharpS(flat.ToUC16Vector(), result);
+ }
+
+ return *result;
+ }
+
+ return LocaleConvertCase(s, isolate, true, "");
+}
+
+RUNTIME_FUNCTION(Runtime_StringLocaleConvertCase) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(args.length(), 3);
+ CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
+ CONVERT_BOOLEAN_ARG_CHECKED(is_upper, 1);
+ CONVERT_ARG_HANDLE_CHECKED(SeqOneByteString, lang, 2);
+
+ // All the languages requiring special handling ("az", "el", "lt", "tr")
+ // have a 2-letter language code.
+ DCHECK(lang->length() == 2);
+ uint8_t lang_str[3];
+ memcpy(lang_str, lang->GetChars(), 2);
+ lang_str[2] = 0;
+ s = String::Flatten(s);
+ // TODO(jshin): Consider adding a fast path for ASCII or Latin-1. The fastpath
+ // in the root locale needs to be adjusted for az, lt and tr because even case
+ // mapping of ASCII range characters are different in those locales.
+ // Greek (el) does not require any adjustment, though.
+ return LocaleConvertCase(s, isolate, is_upper,
+ reinterpret_cast<const char*>(lang_str));
+}
+
} // namespace internal
} // namespace v8
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index d871fc7..f805fdb 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -96,6 +96,59 @@
return isolate->StackOverflow();
}
+RUNTIME_FUNCTION(Runtime_ThrowWasmError) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_SMI_ARG_CHECKED(message_id, 0);
+ CONVERT_SMI_ARG_CHECKED(byte_offset, 1);
+ Handle<Object> error_obj = isolate->factory()->NewError(
+ static_cast<MessageTemplate::Template>(message_id));
+
+ // For wasm traps, the byte offset (a.k.a source position) can not be
+ // determined from relocation info, since the explicit checks for traps
+ // converge in one singe block which calls this runtime function.
+ // We hence pass the byte offset explicitely, and patch it into the top-most
+ // frame (a wasm frame) on the collected stack trace.
+ // TODO(wasm): This implementation is temporary, see bug #5007:
+ // https://bugs.chromium.org/p/v8/issues/detail?id=5007
+ Handle<JSObject> error = Handle<JSObject>::cast(error_obj);
+ Handle<Object> stack_trace_obj = JSReceiver::GetDataProperty(
+ error, isolate->factory()->stack_trace_symbol());
+ // Patch the stack trace (array of <receiver, function, code, position>).
+ if (stack_trace_obj->IsJSArray()) {
+ Handle<FixedArray> stack_elements(
+ FixedArray::cast(JSArray::cast(*stack_trace_obj)->elements()));
+ DCHECK_EQ(1, stack_elements->length() % 4);
+ DCHECK(Code::cast(stack_elements->get(3))->kind() == Code::WASM_FUNCTION);
+ DCHECK(stack_elements->get(4)->IsSmi() &&
+ Smi::cast(stack_elements->get(4))->value() >= 0);
+ stack_elements->set(4, Smi::FromInt(-1 - byte_offset));
+ }
+ Handle<Object> detailed_stack_trace_obj = JSReceiver::GetDataProperty(
+ error, isolate->factory()->detailed_stack_trace_symbol());
+ // Patch the detailed stack trace (array of JSObjects with various
+ // properties).
+ if (detailed_stack_trace_obj->IsJSArray()) {
+ Handle<FixedArray> stack_elements(
+ FixedArray::cast(JSArray::cast(*detailed_stack_trace_obj)->elements()));
+ DCHECK_GE(stack_elements->length(), 1);
+ Handle<JSObject> top_frame(JSObject::cast(stack_elements->get(0)));
+ Handle<String> wasm_offset_key =
+ isolate->factory()->InternalizeOneByteString(
+ STATIC_CHAR_VECTOR("column"));
+ LookupIterator it(top_frame, wasm_offset_key, top_frame,
+ LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
+ if (it.IsFound()) {
+ DCHECK(JSReceiver::GetDataProperty(&it)->IsSmi());
+ Maybe<bool> data_set = JSReceiver::SetDataProperty(
+ &it, handle(Smi::FromInt(byte_offset), isolate));
+ DCHECK(data_set.IsJust() && data_set.FromJust() == true);
+ USE(data_set);
+ }
+ }
+
+ return isolate->Throw(*error_obj);
+}
RUNTIME_FUNCTION(Runtime_UnwindAndFindExceptionHandler) {
SealHandleScope shs(isolate);
@@ -160,6 +213,15 @@
isolate, NewTypeError(MessageTemplate::kIllegalInvocation));
}
+RUNTIME_FUNCTION(Runtime_ThrowIncompatibleMethodReceiver) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, arg1, 1);
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate,
+ NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, arg0, arg1));
+}
RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject) {
HandleScope scope(isolate);
@@ -170,6 +232,12 @@
NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value));
}
+RUNTIME_FUNCTION(Runtime_ThrowGeneratorRunning) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(0, args.length());
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kGeneratorRunning));
+}
RUNTIME_FUNCTION(Runtime_ThrowApplyNonFunction) {
HandleScope scope(isolate);
@@ -309,15 +377,15 @@
return *result;
}
-#define CALLSITE_GET(NAME, RETURN) \
- RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \
- HandleScope scope(isolate); \
- DCHECK(args.length() == 1); \
- CONVERT_ARG_HANDLE_CHECKED(JSObject, call_site_obj, 0); \
- Handle<String> result; \
- CallSite call_site(isolate, call_site_obj); \
- RUNTIME_ASSERT(call_site.IsValid()); \
- return RETURN(call_site.NAME(), isolate); \
+#define CALLSITE_GET(NAME, RETURN) \
+ RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \
+ HandleScope scope(isolate); \
+ DCHECK(args.length() == 1); \
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, call_site_obj, 0); \
+ Handle<String> result; \
+ CallSite call_site(isolate, call_site_obj); \
+ RUNTIME_ASSERT(call_site.IsJavaScript() || call_site.IsWasm()); \
+ return RETURN(call_site.NAME(), isolate); \
}
static inline Object* ReturnDereferencedHandle(Handle<Object> obj,
@@ -416,6 +484,13 @@
isolate, NewTypeError(MessageTemplate::kCalledNonCallable, callsite));
}
+RUNTIME_FUNCTION(Runtime_ThrowCalledOnNullOrUndefined) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kCalledOnNullOrUndefined, name));
+}
RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) {
HandleScope scope(isolate);
@@ -456,21 +531,75 @@
return isolate->heap()->undefined_value();
}
-RUNTIME_FUNCTION(Runtime_GetOrdinaryHasInstance) {
- HandleScope scope(isolate);
- DCHECK_EQ(0, args.length());
-
- return isolate->native_context()->ordinary_has_instance();
-}
-
RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) {
HandleScope scope(isolate);
- DCHECK_EQ(0, args.length());
- std::stringstream stats_stream;
- isolate->counters()->runtime_call_stats()->Print(stats_stream);
- Handle<String> result =
- isolate->factory()->NewStringFromAsciiChecked(stats_stream.str().c_str());
- isolate->counters()->runtime_call_stats()->Reset();
+ if (args.length() == 0) {
+ // Without arguments, the result is returned as a string.
+ DCHECK_EQ(0, args.length());
+ std::stringstream stats_stream;
+ isolate->counters()->runtime_call_stats()->Print(stats_stream);
+ Handle<String> result = isolate->factory()->NewStringFromAsciiChecked(
+ stats_stream.str().c_str());
+ isolate->counters()->runtime_call_stats()->Reset();
+ return *result;
+ } else {
+ DCHECK_LE(args.length(), 2);
+ std::FILE* f;
+ if (args[0]->IsString()) {
+ // With a string argument, the results are appended to that file.
+ CONVERT_ARG_HANDLE_CHECKED(String, arg0, 0);
+ String::FlatContent flat = arg0->GetFlatContent();
+ const char* filename =
+ reinterpret_cast<const char*>(&(flat.ToOneByteVector()[0]));
+ f = std::fopen(filename, "a");
+ DCHECK_NOT_NULL(f);
+ } else {
+ // With an integer argument, the results are written to stdout/stderr.
+ CONVERT_SMI_ARG_CHECKED(fd, 0);
+ DCHECK(fd == 1 || fd == 2);
+ f = fd == 1 ? stdout : stderr;
+ }
+ // The second argument (if any) is a message header to be printed.
+ if (args.length() >= 2) {
+ CONVERT_ARG_HANDLE_CHECKED(String, arg1, 1);
+ arg1->PrintOn(f);
+ std::fputc('\n', f);
+ std::fflush(f);
+ }
+ OFStream stats_stream(f);
+ isolate->counters()->runtime_call_stats()->Print(stats_stream);
+ isolate->counters()->runtime_call_stats()->Reset();
+ if (args[0]->IsString())
+ std::fclose(f);
+ else
+ std::fflush(f);
+ return isolate->heap()->undefined_value();
+ }
+}
+
+RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, microtask, 0);
+ isolate->EnqueueMicrotask(microtask);
+ return isolate->heap()->undefined_value();
+}
+
+RUNTIME_FUNCTION(Runtime_RunMicrotasks) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 0);
+ isolate->RunMicrotasks();
+ return isolate->heap()->undefined_value();
+}
+
+RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Object, callable, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, object, 1);
+ Handle<Object> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result, Object::OrdinaryHasInstance(isolate, callable, object));
return *result;
}
diff --git a/src/runtime/runtime-interpreter.cc b/src/runtime/runtime-interpreter.cc
index 22ae911..f870d23 100644
--- a/src/runtime/runtime-interpreter.cc
+++ b/src/runtime/runtime-interpreter.cc
@@ -64,14 +64,11 @@
os << " ]" << std::endl;
}
- // Find the location of the register file.
+ // Print the registers.
JavaScriptFrameIterator frame_iterator(
bytecode_iterator.bytecode_array()->GetIsolate());
- JavaScriptFrame* frame = frame_iterator.frame();
- Address register_file =
- frame->fp() + InterpreterFrameConstants::kRegisterFilePointerFromFp;
-
- // Print the registers.
+ InterpretedFrame* frame =
+ reinterpret_cast<InterpretedFrame*>(frame_iterator.frame());
int operand_count = interpreter::Bytecodes::NumberOfOperands(bytecode);
for (int operand_index = 0; operand_index < operand_count; operand_index++) {
interpreter::OperandType operand_type =
@@ -86,8 +83,7 @@
int range = bytecode_iterator.GetRegisterOperandRange(operand_index);
for (int reg_index = first_reg.index();
reg_index < first_reg.index() + range; reg_index++) {
- Address reg_location = register_file - reg_index * kPointerSize;
- Object* reg_object = Memory::Object_at(reg_location);
+ Object* reg_object = frame->ReadInterpreterRegister(reg_index);
os << " [ " << std::setw(kRegFieldWidth)
<< interpreter::Register(reg_index).ToString(
bytecode_iterator.bytecode_array()->parameter_count())
@@ -117,10 +113,10 @@
AdvanceToOffsetForTracing(bytecode_iterator, offset);
if (offset == bytecode_iterator.current_offset()) {
// Print bytecode.
- const uint8_t* bytecode_address =
- reinterpret_cast<const uint8_t*>(*bytecode_array) + bytecode_offset;
- os << " -> " << static_cast<const void*>(bytecode_address)
- << " (" << bytecode_offset << ") : ";
+ const uint8_t* base_address = bytecode_array->GetFirstBytecodeAddress();
+ const uint8_t* bytecode_address = base_address + offset;
+ os << " -> " << static_cast<const void*>(bytecode_address) << " @ "
+ << std::setw(4) << offset << " : ";
interpreter::Bytecodes::Decode(os, bytecode_address,
bytecode_array->parameter_count());
os << std::endl;
diff --git a/src/runtime/runtime-json.cc b/src/runtime/runtime-json.cc
index 07232d5..72fc758 100644
--- a/src/runtime/runtime-json.cc
+++ b/src/runtime/runtime-json.cc
@@ -8,7 +8,6 @@
#include "src/char-predicates-inl.h"
#include "src/isolate-inl.h"
#include "src/json-parser.h"
-#include "src/json-stringifier.h"
#include "src/objects-inl.h"
namespace v8 {
@@ -20,23 +19,20 @@
DCHECK(args.length() == 1);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, BasicJsonStringifier::StringifyString(isolate, string));
+ isolate, result, Runtime::BasicJsonStringifyString(isolate, string));
return *result;
}
-
RUNTIME_FUNCTION(Runtime_BasicJSONStringify) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
- BasicJsonStringifier stringifier(isolate);
Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
- stringifier.Stringify(object));
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result, Runtime::BasicJsonStringify(isolate, object));
return *result;
}
-
RUNTIME_FUNCTION(Runtime_ParseJson) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
diff --git a/src/runtime/runtime-literals.cc b/src/runtime/runtime-literals.cc
index f14a7cf..34feeba 100644
--- a/src/runtime/runtime-literals.cc
+++ b/src/runtime/runtime-literals.cc
@@ -109,7 +109,7 @@
return boilerplate;
}
-MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
+static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
Isolate* isolate, Handle<LiteralsArray> literals,
Handle<FixedArray> elements) {
// Create the JSArray.
@@ -191,8 +191,7 @@
case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS:
return CreateObjectLiteralBoilerplate(isolate, literals, elements, false);
case CompileTimeValue::ARRAY_LITERAL:
- return Runtime::CreateArrayLiteralBoilerplate(isolate, literals,
- elements);
+ return CreateArrayLiteralBoilerplate(isolate, literals, elements);
default:
UNREACHABLE();
return MaybeHandle<Object>();
@@ -280,7 +279,7 @@
Handle<Object> boilerplate;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, boilerplate,
- Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements),
+ CreateArrayLiteralBoilerplate(isolate, literals, elements),
AllocationSite);
AllocationSiteCreationContext creation_context(isolate);
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 5bdb085..8c9c230 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -8,6 +8,7 @@
#include "src/bootstrapper.h"
#include "src/debug/debug.h"
#include "src/isolate-inl.h"
+#include "src/json-stringifier.h"
#include "src/messages.h"
#include "src/property-descriptor.h"
#include "src/runtime/runtime.h"
@@ -119,7 +120,7 @@
LanguageMode language_mode) {
bool success = false;
LookupIterator it = LookupIterator::PropertyOrElement(
- isolate, receiver, key, &success, LookupIterator::HIDDEN);
+ isolate, receiver, key, &success, LookupIterator::OWN);
if (!success) return Nothing<bool>();
return JSReceiver::DeleteProperty(&it, language_mode);
@@ -168,7 +169,7 @@
}
// Slow case.
- LookupIterator::Configuration c = LookupIterator::HIDDEN;
+ LookupIterator::Configuration c = LookupIterator::OWN;
LookupIterator it = key_is_array_index
? LookupIterator(isolate, js_obj, index, js_obj, c)
: LookupIterator(js_obj, key, js_obj, c);
@@ -225,6 +226,15 @@
return value;
}
+MaybeHandle<Object> Runtime::BasicJsonStringify(Isolate* isolate,
+ Handle<Object> object) {
+ return BasicJsonStringifier(isolate).Stringify(object);
+}
+
+MaybeHandle<Object> Runtime::BasicJsonStringifyString(Isolate* isolate,
+ Handle<String> string) {
+ return BasicJsonStringifier::StringifyString(isolate, string);
+}
RUNTIME_FUNCTION(Runtime_GetPrototype) {
HandleScope scope(isolate);
@@ -260,85 +270,6 @@
return *obj;
}
-
-// Enumerator used as indices into the array returned from GetOwnProperty
-enum PropertyDescriptorIndices {
- IS_ACCESSOR_INDEX,
- VALUE_INDEX,
- GETTER_INDEX,
- SETTER_INDEX,
- WRITABLE_INDEX,
- ENUMERABLE_INDEX,
- CONFIGURABLE_INDEX,
- DESCRIPTOR_SIZE
-};
-
-
-MUST_USE_RESULT static MaybeHandle<Object> GetOwnProperty(Isolate* isolate,
- Handle<JSObject> obj,
- Handle<Name> name) {
- Heap* heap = isolate->heap();
- Factory* factory = isolate->factory();
-
- // Get attributes.
- LookupIterator it = LookupIterator::PropertyOrElement(isolate, obj, name, obj,
- LookupIterator::HIDDEN);
- Maybe<PropertyAttributes> maybe = JSObject::GetPropertyAttributes(&it);
-
- if (!maybe.IsJust()) return MaybeHandle<Object>();
- PropertyAttributes attrs = maybe.FromJust();
- if (attrs == ABSENT) return factory->undefined_value();
-
- DCHECK(!isolate->has_pending_exception());
- Handle<FixedArray> elms = factory->NewFixedArray(DESCRIPTOR_SIZE);
- elms->set(ENUMERABLE_INDEX, heap->ToBoolean((attrs & DONT_ENUM) == 0));
- elms->set(CONFIGURABLE_INDEX, heap->ToBoolean((attrs & DONT_DELETE) == 0));
-
- bool is_accessor_pair = it.state() == LookupIterator::ACCESSOR &&
- it.GetAccessors()->IsAccessorPair();
- elms->set(IS_ACCESSOR_INDEX, heap->ToBoolean(is_accessor_pair));
-
- if (is_accessor_pair) {
- Handle<AccessorPair> accessors =
- Handle<AccessorPair>::cast(it.GetAccessors());
- Handle<Object> getter =
- AccessorPair::GetComponent(accessors, ACCESSOR_GETTER);
- Handle<Object> setter =
- AccessorPair::GetComponent(accessors, ACCESSOR_SETTER);
- elms->set(GETTER_INDEX, *getter);
- elms->set(SETTER_INDEX, *setter);
- } else {
- Handle<Object> value;
- ASSIGN_RETURN_ON_EXCEPTION(isolate, value, Object::GetProperty(&it),
- Object);
- elms->set(WRITABLE_INDEX, heap->ToBoolean((attrs & READ_ONLY) == 0));
- elms->set(VALUE_INDEX, *value);
- }
-
- return factory->NewJSArrayWithElements(elms);
-}
-
-
-// Returns an array with the property description:
-// if args[1] is not a property on args[0]
-// returns undefined
-// if args[1] is a data property on args[0]
-// [false, value, Writeable, Enumerable, Configurable]
-// if args[1] is an accessor on args[0]
-// [true, GetFunction, SetFunction, Enumerable, Configurable]
-// TODO(jkummerow): Deprecated. Remove all callers and delete.
-RUNTIME_FUNCTION(Runtime_GetOwnProperty_Legacy) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
- CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
- GetOwnProperty(isolate, obj, name));
- return *result;
-}
-
-
RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
@@ -369,7 +300,7 @@
Handle<Name> name(scope_info->ContextSlotName(slot), isolate);
Handle<JSGlobalObject> global_object(script_context->global_object(),
isolate);
- LookupIterator it(global_object, name, global_object, LookupIterator::HIDDEN);
+ LookupIterator it(global_object, name, global_object, LookupIterator::OWN);
// Switch to fast mode only if there is a data property and it's not on
// a hidden prototype.
@@ -404,7 +335,7 @@
Handle<Name> name(scope_info->ContextSlotName(slot), isolate);
Handle<JSGlobalObject> global_object(script_context->global_object(),
isolate);
- LookupIterator it(global_object, name, global_object, LookupIterator::HIDDEN);
+ LookupIterator it(global_object, name, global_object, LookupIterator::OWN);
// Switch to fast mode only if there is a data property and it's not on
// a hidden prototype.
@@ -726,30 +657,6 @@
}
-RUNTIME_FUNCTION(Runtime_GlobalProxy) {
- SealHandleScope shs(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_CHECKED(JSFunction, function, 0);
- return function->context()->global_proxy();
-}
-
-
-RUNTIME_FUNCTION(Runtime_LookupAccessor) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 3);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
- CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
- CONVERT_SMI_ARG_CHECKED(flag, 2);
- AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER;
- if (!receiver->IsJSObject()) return isolate->heap()->undefined_value();
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- JSObject::GetAccessor(Handle<JSObject>::cast(receiver), name, component));
- return *result;
-}
-
-
RUNTIME_FUNCTION(Runtime_LoadMutableDouble) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
@@ -823,34 +730,6 @@
}
-// Implements part of 8.12.9 DefineOwnProperty.
-// There are 3 cases that lead here:
-// Step 4a - define a new data property.
-// Steps 9b & 12 - replace an existing accessor property with a data property.
-// Step 12 - update an existing data property with a data or generic
-// descriptor.
-RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 4);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
- CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
- CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
- CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
-
- LookupIterator it = LookupIterator::PropertyOrElement(
- isolate, object, name, object, LookupIterator::OWN);
- if (it.state() == LookupIterator::ACCESS_CHECK && !it.HasAccess()) {
- return isolate->heap()->undefined_value();
- }
-
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, JSObject::DefineOwnPropertyIgnoreAttributes(
- &it, value, attrs, JSObject::DONT_FORCE_FIELD));
-
- return *result;
-}
-
RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) {
HandleScope scope(isolate);
DCHECK(args.length() == 5);
@@ -1104,97 +983,6 @@
return isolate->heap()->exception();
}
-
-RUNTIME_FUNCTION(Runtime_InstanceOf) {
- // TODO(4447): Remove this function when ES6 instanceof ships for good.
- DCHECK(!FLAG_harmony_instanceof);
-
- // ECMA-262, section 11.8.6, page 54.
- HandleScope shs(isolate);
- DCHECK_EQ(2, args.length());
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, callable, 1);
- // {callable} must have a [[Call]] internal method.
- if (!callable->IsCallable()) {
- THROW_NEW_ERROR_RETURN_FAILURE(
- isolate,
- NewTypeError(MessageTemplate::kInstanceofFunctionExpected, callable));
- }
- // If {object} is not a receiver, return false.
- if (!object->IsJSReceiver()) {
- return isolate->heap()->false_value();
- }
- // Check if {callable} is bound, if so, get [[BoundTargetFunction]] from it
- // and use that instead of {callable}.
- while (callable->IsJSBoundFunction()) {
- callable =
- handle(Handle<JSBoundFunction>::cast(callable)->bound_target_function(),
- isolate);
- }
- DCHECK(callable->IsCallable());
- // Get the "prototype" of {callable}; raise an error if it's not a receiver.
- Handle<Object> prototype;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, prototype,
- JSReceiver::GetProperty(Handle<JSReceiver>::cast(callable),
- isolate->factory()->prototype_string()));
- if (!prototype->IsJSReceiver()) {
- THROW_NEW_ERROR_RETURN_FAILURE(
- isolate,
- NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype));
- }
- // Return whether or not {prototype} is in the prototype chain of {object}.
- Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
- Maybe<bool> result =
- JSReceiver::HasInPrototypeChain(isolate, receiver, prototype);
- MAYBE_RETURN(result, isolate->heap()->exception());
- return isolate->heap()->ToBoolean(result.FromJust());
-}
-
-RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance) {
- // ES6 section 19.2.3.6 Function.prototype[@@hasInstance](V)
- HandleScope shs(isolate);
- DCHECK_EQ(2, args.length());
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, callable, 1);
- // {callable} must have a [[Call]] internal method.
- if (!callable->IsCallable()) {
- return isolate->heap()->false_value();
- }
- // If {object} is not a receiver, return false.
- if (!object->IsJSReceiver()) {
- return isolate->heap()->false_value();
- }
- // Check if {callable} is bound, if so, get [[BoundTargetFunction]] from it
- // and use that instead of {callable}.
- while (callable->IsJSBoundFunction()) {
- callable =
- handle(Handle<JSBoundFunction>::cast(callable)->bound_target_function(),
- isolate);
- }
- DCHECK(callable->IsCallable());
- // Get the "prototype" of {callable}; raise an error if it's not a receiver.
- Handle<Object> prototype;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, prototype,
- JSReceiver::GetProperty(Handle<JSReceiver>::cast(callable),
- isolate->factory()->prototype_string()));
- if (!prototype->IsJSReceiver()) {
- THROW_NEW_ERROR_RETURN_FAILURE(
- isolate,
- NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype));
- }
- // Return whether or not {prototype} is in the prototype chain of {object}.
- Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
- Maybe<bool> result =
- JSReceiver::HasInPrototypeChain(isolate, receiver, prototype);
- MAYBE_RETURN(result, isolate->heap()->exception());
- return isolate->heap()->ToBoolean(result.FromJust());
-}
-
-
RUNTIME_FUNCTION(Runtime_HasInPrototypeChain) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
@@ -1229,24 +1017,20 @@
}
-RUNTIME_FUNCTION(Runtime_ObjectDefineProperty) {
+RUNTIME_FUNCTION(Runtime_CreateDataProperty) {
HandleScope scope(isolate);
DCHECK(args.length() == 3);
- CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, name, 1);
- CONVERT_ARG_HANDLE_CHECKED(Object, attributes, 2);
- return JSReceiver::DefineProperty(isolate, o, name, attributes);
-}
-
-
-RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, o, JSReceiver::DefineProperties(isolate, o, properties));
- return *o;
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, o, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
+ bool success;
+ LookupIterator it = LookupIterator::PropertyOrElement(
+ isolate, o, key, &success, LookupIterator::OWN);
+ if (!success) return isolate->heap()->exception();
+ MAYBE_RETURN(
+ JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR),
+ isolate->heap()->exception());
+ return *value;
}
} // namespace internal
diff --git a/src/runtime/runtime-observe.cc b/src/runtime/runtime-observe.cc
deleted file mode 100644
index 0407b8a..0000000
--- a/src/runtime/runtime-observe.cc
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/runtime/runtime-utils.h"
-
-#include "src/arguments.h"
-#include "src/debug/debug.h"
-#include "src/isolate-inl.h"
-
-namespace v8 {
-namespace internal {
-
-RUNTIME_FUNCTION(Runtime_IsObserved) {
- SealHandleScope shs(isolate);
- DCHECK(args.length() == 1);
-
- if (!args[0]->IsJSReceiver()) return isolate->heap()->false_value();
- CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
- DCHECK(!obj->IsJSGlobalProxy() || !obj->map()->is_observed());
- return isolate->heap()->ToBoolean(obj->map()->is_observed());
-}
-
-
-RUNTIME_FUNCTION(Runtime_SetIsObserved) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0);
- RUNTIME_ASSERT(!obj->IsJSGlobalProxy());
- if (obj->IsJSProxy()) return isolate->heap()->undefined_value();
- RUNTIME_ASSERT(!obj->map()->is_observed());
-
- DCHECK(obj->IsJSObject());
- JSObject::SetObserved(Handle<JSObject>::cast(obj));
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, microtask, 0);
- isolate->EnqueueMicrotask(microtask);
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_RunMicrotasks) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 0);
- isolate->RunMicrotasks();
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_DeliverObservationChangeRecords) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, callback, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, argument, 1);
- v8::TryCatch catcher(reinterpret_cast<v8::Isolate*>(isolate));
- // We should send a message on uncaught exception thrown during
- // Object.observe delivery while not interrupting further delivery, thus
- // we make a call inside a verbose TryCatch.
- catcher.SetVerbose(true);
- Handle<Object> argv[] = {argument};
-
- // If we are in step-in mode, flood the handler.
- isolate->debug()->EnableStepIn();
-
- USE(Execution::Call(isolate, callback, isolate->factory()->undefined_value(),
- arraysize(argv), argv));
- if (isolate->has_pending_exception()) {
- isolate->ReportPendingMessages();
- isolate->clear_pending_exception();
- isolate->set_external_caught_exception(false);
- }
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetObservationState) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 0);
- isolate->CountUsage(v8::Isolate::kObjectObserve);
- return isolate->heap()->observation_state();
-}
-
-
-static bool ContextsHaveSameOrigin(Handle<Context> context1,
- Handle<Context> context2) {
- return context1->security_token() == context2->security_token();
-}
-
-
-RUNTIME_FUNCTION(Runtime_ObserverObjectAndRecordHaveSameOrigin) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 3);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, observer, 0);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, record, 2);
-
- while (observer->IsJSBoundFunction()) {
- observer = handle(
- Handle<JSBoundFunction>::cast(observer)->bound_target_function());
- }
- if (!observer->IsJSFunction()) return isolate->heap()->false_value();
-
- Handle<Context> observer_context(
- Handle<JSFunction>::cast(observer)->context()->native_context());
- Handle<Context> object_context(object->GetCreationContext());
- Handle<Context> record_context(record->GetCreationContext());
-
- return isolate->heap()->ToBoolean(
- ContextsHaveSameOrigin(object_context, observer_context) &&
- ContextsHaveSameOrigin(object_context, record_context));
-}
-
-
-RUNTIME_FUNCTION(Runtime_ObjectWasCreatedInCurrentOrigin) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-
- Handle<Context> creation_context(object->GetCreationContext(), isolate);
- return isolate->heap()->ToBoolean(
- ContextsHaveSameOrigin(creation_context, isolate->native_context()));
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetObjectContextObjectObserve) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-
- Handle<Context> context(object->GetCreationContext(), isolate);
- return context->native_object_observe();
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetObjectContextObjectGetNotifier) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-
- Handle<Context> context(object->GetCreationContext(), isolate);
- return context->native_object_get_notifier();
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetObjectContextNotifierPerformChange) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0);
-
- Handle<Context> context(object_info->GetCreationContext(), isolate);
- return context->native_object_notifier_perform_change();
-}
-} // namespace internal
-} // namespace v8
diff --git a/src/runtime/runtime-operators.cc b/src/runtime/runtime-operators.cc
index e55ab7c..78dd16f 100644
--- a/src/runtime/runtime-operators.cc
+++ b/src/runtime/runtime-operators.cc
@@ -216,5 +216,16 @@
return isolate->heap()->ToBoolean(result.FromJust());
}
+RUNTIME_FUNCTION(Runtime_InstanceOf) {
+ HandleScope shs(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, callable, 1);
+ Handle<Object> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result, Object::InstanceOf(isolate, object, callable));
+ return *result;
+}
+
} // namespace internal
} // namespace v8
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index de0d66a..68df582 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -44,8 +44,7 @@
}
// Do the lookup own properties only, see ES5 erratum.
- LookupIterator it(global, name, global,
- LookupIterator::HIDDEN_SKIP_INTERCEPTOR);
+ LookupIterator it(global, name, global, LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (!maybe.IsJust()) return isolate->heap()->exception();
@@ -182,8 +181,7 @@
Handle<JSGlobalObject> global = isolate->global_object();
// Lookup the property as own on the global object.
- LookupIterator it(global, name, global,
- LookupIterator::HIDDEN_SKIP_INTERCEPTOR);
+ LookupIterator it(global, name, global, LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
DCHECK(maybe.IsJust());
PropertyAttributes old_attributes = maybe.FromJust();
@@ -237,10 +235,7 @@
// Check for a conflict with a lexically scoped variable
context_arg->Lookup(name, LEXICAL_TEST, &index, &attributes,
&binding_flags);
- if (attributes != ABSENT &&
- (binding_flags == MUTABLE_CHECK_INITIALIZED ||
- binding_flags == IMMUTABLE_CHECK_INITIALIZED ||
- binding_flags == IMMUTABLE_CHECK_INITIALIZED_HARMONY)) {
+ if (attributes != ABSENT && binding_flags == BINDING_CHECK_INITIALIZED) {
return ThrowRedeclarationError(isolate, name);
}
attr = static_cast<PropertyAttributes>(attr & ~EVAL_DECLARED);
@@ -339,86 +334,6 @@
}
-RUNTIME_FUNCTION(Runtime_InitializeLegacyConstLookupSlot) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 3);
-
- CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
- DCHECK(!value->IsTheHole());
- // Initializations are always done in a function or native context.
- CONVERT_ARG_HANDLE_CHECKED(Context, context_arg, 1);
- Handle<Context> context(context_arg->declaration_context());
- CONVERT_ARG_HANDLE_CHECKED(String, name, 2);
-
- int index;
- PropertyAttributes attributes;
- ContextLookupFlags flags = DONT_FOLLOW_CHAINS;
- BindingFlags binding_flags;
- Handle<Object> holder =
- context->Lookup(name, flags, &index, &attributes, &binding_flags);
- if (holder.is_null()) {
- // In case of JSProxy, an exception might have been thrown.
- if (isolate->has_pending_exception()) return isolate->heap()->exception();
- }
-
- if (index != Context::kNotFound) {
- DCHECK(holder->IsContext());
- // Property was found in a context. Perform the assignment if the constant
- // was uninitialized.
- Handle<Context> context = Handle<Context>::cast(holder);
- DCHECK((attributes & READ_ONLY) != 0);
- if (context->get(index)->IsTheHole()) context->set(index, *value);
- return *value;
- }
-
- PropertyAttributes attr =
- static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY);
-
- // Strict mode handling not needed (legacy const is disallowed in strict
- // mode).
-
- // The declared const was configurable, and may have been deleted in the
- // meanwhile. If so, re-introduce the variable in the context extension.
- if (attributes == ABSENT) {
- Handle<Context> declaration_context(context_arg->declaration_context());
- if (declaration_context->IsScriptContext()) {
- holder = handle(declaration_context->global_object(), isolate);
- } else {
- holder = handle(declaration_context->extension_object(), isolate);
- DCHECK(!holder.is_null());
- }
- CHECK(holder->IsJSObject());
- } else {
- // For JSContextExtensionObjects, the initializer can be run multiple times
- // if in a for loop: for (var i = 0; i < 2; i++) { const x = i; }. Only the
- // first assignment should go through. For JSGlobalObjects, additionally any
- // code can run in between that modifies the declared property.
- DCHECK(holder->IsJSGlobalObject() || holder->IsJSContextExtensionObject());
-
- LookupIterator it(holder, name, Handle<JSReceiver>::cast(holder),
- LookupIterator::HIDDEN_SKIP_INTERCEPTOR);
- Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
- if (!maybe.IsJust()) return isolate->heap()->exception();
- PropertyAttributes old_attributes = maybe.FromJust();
-
- // Ignore if we can't reconfigure the value.
- if ((old_attributes & DONT_DELETE) != 0) {
- if ((old_attributes & READ_ONLY) != 0 ||
- it.state() == LookupIterator::ACCESSOR) {
- return *value;
- }
- attr = static_cast<PropertyAttributes>(old_attributes | READ_ONLY);
- }
- }
-
- RETURN_FAILURE_ON_EXCEPTION(
- isolate, JSObject::SetOwnPropertyIgnoreAttributes(
- Handle<JSObject>::cast(holder), name, value, attr));
-
- return *value;
-}
-
-
namespace {
// Find the arguments of the JavaScript function invocation that called
@@ -648,7 +563,7 @@
{
DisallowHeapAllocation no_gc;
FixedArray* elements = FixedArray::cast(result->elements());
- WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
+ WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
for (int i = 0; i < num_elements; i++) {
elements->set(i, *arguments[i + start_index], mode);
}
@@ -663,12 +578,6 @@
CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0);
Object** parameters = reinterpret_cast<Object**>(args[1]);
CONVERT_SMI_ARG_CHECKED(argument_count, 2);
-#ifdef DEBUG
- // This runtime function does not materialize the correct arguments when the
- // caller has been inlined, better make sure we are not hitting that case.
- JavaScriptFrameIterator it(isolate);
- DCHECK(!it.frame()->HasInlinedFrames());
-#endif // DEBUG
ParameterArguments argument_getter(parameters);
return *NewSloppyArguments(isolate, callee, argument_getter, argument_count);
}
@@ -711,7 +620,7 @@
if (IsLexicalVariableMode(mode)) {
LookupIterator it(global_object, name, global_object,
- LookupIterator::HIDDEN_SKIP_INTERCEPTOR);
+ LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (!maybe.IsJust()) return isolate->heap()->exception();
if ((maybe.FromJust() & DONT_DELETE) != 0) {
@@ -875,8 +784,7 @@
case VAR:
case LET:
case CONST:
- case CONST_LEGACY:
- case IMPORT: {
+ case CONST_LEGACY: {
PropertyAttributes attr =
IsImmutableVariableMode(mode) ? FROZEN : SEALED;
Handle<AccessorInfo> info =
@@ -961,23 +869,14 @@
Handle<Object> value = handle(Context::cast(*holder)->get(index), isolate);
// Check for uninitialized bindings.
switch (flags) {
- case MUTABLE_CHECK_INITIALIZED:
- case IMMUTABLE_CHECK_INITIALIZED_HARMONY:
+ case BINDING_CHECK_INITIALIZED:
if (value->IsTheHole()) {
THROW_NEW_ERROR(isolate,
NewReferenceError(MessageTemplate::kNotDefined, name),
Object);
}
// FALLTHROUGH
- case IMMUTABLE_CHECK_INITIALIZED:
- if (value->IsTheHole()) {
- DCHECK(attributes & READ_ONLY);
- value = isolate->factory()->undefined_value();
- }
- // FALLTHROUGH
- case MUTABLE_IS_INITIALIZED:
- case IMMUTABLE_IS_INITIALIZED:
- case IMMUTABLE_IS_INITIALIZED_HARMONY:
+ case BINDING_IS_INITIALIZED:
DCHECK(!value->IsTheHole());
if (receiver_return) *receiver_return = receiver;
return value;
@@ -1075,8 +974,7 @@
// The property was found in a context slot.
if (index != Context::kNotFound) {
- if ((flags == MUTABLE_CHECK_INITIALIZED ||
- flags == IMMUTABLE_CHECK_INITIALIZED_HARMONY) &&
+ if (flags == BINDING_CHECK_INITIALIZED &&
Handle<Context>::cast(holder)->is_the_hole(index)) {
THROW_NEW_ERROR(isolate,
NewReferenceError(MessageTemplate::kNotDefined, name),
diff --git a/src/runtime/runtime-strings.cc b/src/runtime/runtime-strings.cc
index 6786fa9..0f19bf3 100644
--- a/src/runtime/runtime-strings.cc
+++ b/src/runtime/runtime-strings.cc
@@ -5,10 +5,7 @@
#include "src/runtime/runtime-utils.h"
#include "src/arguments.h"
-#include "src/conversions-inl.h"
-#include "src/isolate-inl.h"
#include "src/regexp/jsregexp-inl.h"
-#include "src/regexp/jsregexp.h"
#include "src/string-builder.h"
#include "src/string-search.h"
@@ -1080,7 +1077,7 @@
RUNTIME_FUNCTION(Runtime_StringToLowerCase) {
HandleScope scope(isolate);
- DCHECK(args.length() == 1);
+ DCHECK_EQ(args.length(), 1);
CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
return ConvertCase(s, isolate, isolate->runtime_state()->to_lower_mapping());
}
@@ -1088,7 +1085,7 @@
RUNTIME_FUNCTION(Runtime_StringToUpperCase) {
HandleScope scope(isolate);
- DCHECK(args.length() == 1);
+ DCHECK_EQ(args.length(), 1);
CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
return ConvertCase(s, isolate, isolate->runtime_state()->to_upper_mapping());
}
@@ -1154,6 +1151,7 @@
return *result;
}
+
RUNTIME_FUNCTION(Runtime_StringLessThan) {
HandleScope handle_scope(isolate);
DCHECK_EQ(2, args.length());
@@ -1273,6 +1271,13 @@
return __RT_impl_Runtime_StringCharFromCode(Arguments(1, &code), isolate);
}
+RUNTIME_FUNCTION(Runtime_ExternalStringGetChar) {
+ SealHandleScope shs(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_ARG_CHECKED(ExternalString, string, 0);
+ CONVERT_INT32_ARG_CHECKED(index, 1);
+ return Smi::FromInt(string->Get(index));
+}
RUNTIME_FUNCTION(Runtime_OneByteSeqStringGetChar) {
SealHandleScope shs(isolate);
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index a0f0566..cc15d0e 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -8,6 +8,7 @@
#include "src/deoptimizer.h"
#include "src/frames-inl.h"
#include "src/full-codegen/full-codegen.h"
+#include "src/isolate-inl.h"
#include "src/snapshot/natives.h"
namespace v8 {
@@ -16,7 +17,16 @@
RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+
+ // This function is used by fuzzers to get coverage in compiler.
+ // Ignore calls on non-function objects to avoid runtime errors.
+ CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
+ // If it is not a JSFunction, just return.
+ if (!function_object->IsJSFunction()) {
+ return isolate->heap()->undefined_value();
+ }
+ Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
+
if (!function->IsOptimized()) return isolate->heap()->undefined_value();
// TODO(turbofan): Deoptimization is not supported yet.
@@ -84,7 +94,16 @@
RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+
+ // This function is used by fuzzers to get coverage for optimizations
+ // in compiler. Ignore calls on non-function objects to avoid runtime errors.
+ CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
+ // If it is not a JSFunction, just return.
+ if (!function_object->IsJSFunction()) {
+ return isolate->heap()->undefined_value();
+ }
+ Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
+
// The following assertion was lifted from the DCHECK inside
// JSFunction::MarkForOptimization().
RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() ||
@@ -135,6 +154,12 @@
RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() ||
!function->shared()->optimization_disabled());
+ // If function is interpreted, just return. OSR is not supported.
+ // TODO(4764): Remove this check when OSR is enabled in the interpreter.
+ if (function->shared()->HasBytecodeArray()) {
+ return isolate->heap()->undefined_value();
+ }
+
// If the function is already optimized, just return.
if (function->IsOptimized()) return isolate->heap()->undefined_value();
@@ -153,7 +178,8 @@
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0);
- function->shared()->set_disable_optimization_reason(kOptimizationDisabled);
+ function->shared()->set_disable_optimization_reason(
+ kOptimizationDisabledForTest);
function->shared()->set_optimization_disabled(true);
return isolate->heap()->undefined_value();
}
@@ -457,6 +483,31 @@
return isolate->heap()->undefined_value();
}
+RUNTIME_FUNCTION(Runtime_GetExceptionDetails) {
+ HandleScope shs(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, exception_obj, 0);
+
+ Factory* factory = isolate->factory();
+ Handle<JSMessageObject> message_obj =
+ isolate->CreateMessage(exception_obj, nullptr);
+
+ Handle<JSObject> message = factory->NewJSObject(isolate->object_function());
+
+ Handle<String> key;
+ Handle<Object> value;
+
+ key = factory->NewStringFromAsciiChecked("start_pos");
+ value = handle(Smi::FromInt(message_obj->start_position()), isolate);
+ JSObject::SetProperty(message, key, value, STRICT).Assert();
+
+ key = factory->NewStringFromAsciiChecked("end_pos");
+ value = handle(Smi::FromInt(message_obj->end_position()), isolate);
+ JSObject::SetProperty(message, key, value, STRICT).Assert();
+
+ return *message;
+}
+
RUNTIME_FUNCTION(Runtime_HaveSameMap) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 2);
diff --git a/src/runtime/runtime-typedarray.cc b/src/runtime/runtime-typedarray.cc
index bf0ee9f..14b1207 100644
--- a/src/runtime/runtime-typedarray.cc
+++ b/src/runtime/runtime-typedarray.cc
@@ -28,6 +28,14 @@
CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, target, 1);
CONVERT_NUMBER_ARG_HANDLE_CHECKED(first, 2);
CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3);
+
+ if (source->was_neutered() || target->was_neutered()) {
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kDetachedOperation,
+ isolate->factory()->NewStringFromAsciiChecked(
+ "ArrayBuffer.prototype.slice")));
+ }
+
RUNTIME_ASSERT(!source.is_identical_to(target));
size_t start = 0, target_length = 0;
RUNTIME_ASSERT(TryNumberToSize(isolate, *first, &start));
@@ -397,7 +405,8 @@
Handle<JSTypedArray> obj(JSTypedArray::cast(args[0]));
return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() &&
obj->type() != kExternalFloat32Array &&
- obj->type() != kExternalFloat64Array);
+ obj->type() != kExternalFloat64Array &&
+ obj->type() != kExternalUint8ClampedArray);
}
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index dc1678b..2c80280 100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -47,25 +47,26 @@
F(GrowArrayElements, 2, 1) \
F(HasComplexElements, 1, 1) \
F(IsArray, 1, 1) \
+ F(ArrayIsArray, 1, 1) \
F(HasCachedArrayIndex, 1, 1) \
F(GetCachedArrayIndex, 1, 1) \
F(FixedArrayGet, 2, 1) \
F(FixedArraySet, 3, 1) \
F(ArraySpeciesConstructor, 1, 1)
-#define FOR_EACH_INTRINSIC_ATOMICS(F) \
- F(AtomicsCompareExchange, 4, 1) \
- F(AtomicsLoad, 2, 1) \
- F(AtomicsStore, 3, 1) \
- F(AtomicsAdd, 3, 1) \
- F(AtomicsSub, 3, 1) \
- F(AtomicsAnd, 3, 1) \
- F(AtomicsOr, 3, 1) \
- F(AtomicsXor, 3, 1) \
- F(AtomicsExchange, 3, 1) \
+#define FOR_EACH_INTRINSIC_ATOMICS(F) \
+ F(ThrowNotIntegerSharedTypedArrayError, 1, 1) \
+ F(ThrowNotInt32SharedTypedArrayError, 1, 1) \
+ F(ThrowInvalidAtomicAccessIndexError, 0, 1) \
+ F(AtomicsCompareExchange, 4, 1) \
+ F(AtomicsAdd, 3, 1) \
+ F(AtomicsSub, 3, 1) \
+ F(AtomicsAnd, 3, 1) \
+ F(AtomicsOr, 3, 1) \
+ F(AtomicsXor, 3, 1) \
+ F(AtomicsExchange, 3, 1) \
F(AtomicsIsLockFree, 1, 1)
-
#define FOR_EACH_INTRINSIC_FUTEX(F) \
F(AtomicsFutexWait, 4, 1) \
F(AtomicsFutexWake, 3, 1) \
@@ -81,7 +82,6 @@
F(ThrowIfStaticPrototype, 1, 1) \
F(HomeObjectSymbol, 0, 1) \
F(DefineClass, 4, 1) \
- F(FinalizeClassDefinition, 2, 1) \
F(LoadFromSuper, 3, 1) \
F(LoadKeyedFromSuper, 3, 1) \
F(StoreToSuper_Strict, 4, 1) \
@@ -117,20 +117,18 @@
F(WeakCollectionHas, 3, 1) \
F(WeakCollectionDelete, 3, 1) \
F(WeakCollectionSet, 4, 1) \
- F(GetWeakSetValues, 2, 1) \
- F(ObservationWeakMapCreate, 0, 1)
-
+ F(GetWeakSetValues, 2, 1)
#define FOR_EACH_INTRINSIC_COMPILER(F) \
F(CompileLazy, 1, 1) \
+ F(CompileBaseline, 1, 1) \
F(CompileOptimized_Concurrent, 1, 1) \
F(CompileOptimized_NotConcurrent, 1, 1) \
F(NotifyStubFailure, 0, 1) \
F(NotifyDeoptimized, 1, 1) \
F(CompileForOnStackReplacement, 1, 1) \
F(TryInstallOptimizedCode, 1, 1) \
- F(ResolvePossiblyDirectEval, 5, 1)
-
+ F(ResolvePossiblyDirectEval, 6, 1)
#define FOR_EACH_INTRINSIC_DATE(F) \
F(IsDate, 1, 1) \
@@ -148,9 +146,6 @@
F(DebugGetProperty, 2, 1) \
F(DebugPropertyTypeFromDetails, 1, 1) \
F(DebugPropertyAttributesFromDetails, 1, 1) \
- F(DebugPropertyIndexFromDetails, 1, 1) \
- F(DebugNamedInterceptorPropertyValue, 2, 1) \
- F(DebugIndexedInterceptorElementValue, 2, 1) \
F(CheckExecutionState, 1, 1) \
F(GetFrameCount, 1, 1) \
F(GetFrameDetails, 2, 1) \
@@ -161,8 +156,6 @@
F(GetFunctionScopeDetails, 2, 1) \
F(SetScopeVariableValue, 6, 1) \
F(DebugPrintScopes, 0, 1) \
- F(GetThreadCount, 1, 1) \
- F(GetThreadDetails, 2, 1) \
F(SetBreakPointsActive, 1, 1) \
F(GetBreakLocations, 2, 1) \
F(SetFunctionBreakPoint, 3, 1) \
@@ -231,19 +224,19 @@
F(FunctionToString, 1, 1)
#define FOR_EACH_INTRINSIC_GENERATOR(F) \
- F(CreateJSGeneratorObject, 0, 1) \
+ F(CreateJSGeneratorObject, 2, 1) \
F(SuspendJSGeneratorObject, 1, 1) \
- F(ResumeJSGeneratorObject, 3, 1) \
F(GeneratorClose, 1, 1) \
F(GeneratorGetFunction, 1, 1) \
F(GeneratorGetReceiver, 1, 1) \
F(GeneratorGetInput, 1, 1) \
+ F(GeneratorSetContext, 1, 1) \
F(GeneratorGetContinuation, 1, 1) \
+ F(GeneratorSetContinuation, 2, 1) \
F(GeneratorGetSourcePosition, 1, 1) \
- F(GeneratorNext, 2, 1) \
- F(GeneratorReturn, 2, 1) \
- F(GeneratorThrow, 2, 1)
-
+ F(GeneratorGetResumeMode, 1, 1) \
+ F(GeneratorLoadRegister, 2, 1) \
+ F(GeneratorStoreRegister, 3, 1)
#ifdef V8_I18N_SUPPORT
#define FOR_EACH_INTRINSIC_I18N(F) \
@@ -269,7 +262,10 @@
F(BreakIteratorFirst, 1, 1) \
F(BreakIteratorNext, 1, 1) \
F(BreakIteratorCurrent, 1, 1) \
- F(BreakIteratorBreakType, 1, 1)
+ F(BreakIteratorBreakType, 1, 1) \
+ F(StringToLowerCaseI18N, 1, 1) \
+ F(StringToUpperCaseI18N, 1, 1) \
+ F(StringLocaleConvertCase, 3, 1)
#else
#define FOR_EACH_INTRINSIC_I18N(F)
#endif
@@ -289,8 +285,11 @@
F(NewSyntaxError, 2, 1) \
F(NewReferenceError, 2, 1) \
F(ThrowIllegalInvocation, 0, 1) \
+ F(ThrowIncompatibleMethodReceiver, 2, 1) \
F(ThrowIteratorResultNotAnObject, 1, 1) \
+ F(ThrowGeneratorRunning, 0, 1) \
F(ThrowStackOverflow, 0, 1) \
+ F(ThrowWasmError, 2, 1) \
F(PromiseRejectEvent, 3, 1) \
F(PromiseRevokeReject, 1, 1) \
F(StackGuard, 0, 1) \
@@ -315,10 +314,14 @@
F(ThrowConstructedNonConstructable, 1, 1) \
F(ThrowDerivedConstructorReturnedNonObject, 0, 1) \
F(ThrowCalledNonCallable, 1, 1) \
+ F(ThrowCalledOnNullOrUndefined, 1, 1) \
F(CreateListFromArrayLike, 1, 1) \
F(IncrementUseCounter, 1, 1) \
- F(GetOrdinaryHasInstance, 0, 1) \
- F(GetAndResetRuntimeCallStats, 0, 1)
+ F(GetAndResetRuntimeCallStats, -1 /* <= 2 */, 1) \
+ F(EnqueueMicrotask, 1, 1) \
+ F(RunMicrotasks, 0, 1) \
+ F(WasmGetFunctionName, 2, 1) \
+ F(OrdinaryHasInstance, 2, 1)
#define FOR_EACH_INTRINSIC_JSON(F) \
F(QuoteJSONString, 1, 1) \
@@ -385,7 +388,6 @@
F(ObjectHasOwnProperty, 2, 1) \
F(InternalSetPrototype, 2, 1) \
F(SetPrototype, 2, 1) \
- F(GetOwnProperty_Legacy, 2, 1) \
F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
F(GetProperty, 2, 1) \
F(KeyedGetProperty, 2, 1) \
@@ -406,13 +408,10 @@
F(AllocateHeapNumber, 0, 1) \
F(NewObject, 2, 1) \
F(FinalizeInstanceSize, 1, 1) \
- F(GlobalProxy, 1, 1) \
- F(LookupAccessor, 3, 1) \
F(LoadMutableDouble, 2, 1) \
F(TryMigrateInstance, 1, 1) \
F(IsJSGlobalProxy, 1, 1) \
F(DefineAccessorPropertyUnchecked, 5, 1) \
- F(DefineDataPropertyUnchecked, 4, 1) \
F(DefineDataPropertyInLiteral, 5, 1) \
F(GetDataProperty, 2, 1) \
F(HasFastPackedElements, 1, 1) \
@@ -433,26 +432,10 @@
F(SameValue, 2, 1) \
F(SameValueZero, 2, 1) \
F(Compare, 3, 1) \
- F(InstanceOf, 2, 1) \
- F(OrdinaryHasInstance, 2, 1) \
F(HasInPrototypeChain, 2, 1) \
F(CreateIterResultObject, 2, 1) \
F(IsAccessCheckNeeded, 1, 1) \
- F(ObjectDefineProperties, 2, 1) \
- F(ObjectDefineProperty, 3, 1)
-
-#define FOR_EACH_INTRINSIC_OBSERVE(F) \
- F(IsObserved, 1, 1) \
- F(SetIsObserved, 1, 1) \
- F(EnqueueMicrotask, 1, 1) \
- F(RunMicrotasks, 0, 1) \
- F(DeliverObservationChangeRecords, 2, 1) \
- F(GetObservationState, 0, 1) \
- F(ObserverObjectAndRecordHaveSameOrigin, 3, 1) \
- F(ObjectWasCreatedInCurrentOrigin, 1, 1) \
- F(GetObjectContextObjectObserve, 1, 1) \
- F(GetObjectContextObjectGetNotifier, 1, 1) \
- F(GetObjectContextNotifierPerformChange, 1, 1)
+ F(CreateDataProperty, 3, 1)
#define FOR_EACH_INTRINSIC_OPERATORS(F) \
F(Multiply, 2, 1) \
@@ -473,7 +456,8 @@
F(LessThan, 2, 1) \
F(GreaterThan, 2, 1) \
F(LessThanOrEqual, 2, 1) \
- F(GreaterThanOrEqual, 2, 1)
+ F(GreaterThanOrEqual, 2, 1) \
+ F(InstanceOf, 2, 1)
#define FOR_EACH_INTRINSIC_PROXY(F) \
F(IsJSProxy, 1, 1) \
@@ -501,7 +485,6 @@
F(InitializeVarGlobal, 3, 1) \
F(InitializeConstGlobal, 2, 1) \
F(DeclareLookupSlot, 3, 1) \
- F(InitializeLegacyConstLookupSlot, 3, 1) \
F(NewSloppyArguments_Generic, 1, 1) \
F(NewStrictArguments, 1, 1) \
F(NewRestParameter, 1, 1) \
@@ -861,6 +844,7 @@
F(FlattenString, 1, 1) \
F(StringCharFromCode, 1, 1) \
F(StringCharAt, 2, 1) \
+ F(ExternalStringGetChar, 2, 1) \
F(OneByteSeqStringGetChar, 2, 1) \
F(OneByteSeqStringSetChar, 3, 1) \
F(TwoByteSeqStringGetChar, 2, 1) \
@@ -892,6 +876,7 @@
F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \
F(DebugPrint, 1, 1) \
F(DebugTrace, 0, 1) \
+ F(GetExceptionDetails, 1, 1) \
F(GlobalPrint, 1, 1) \
F(SystemBreak, 0, 1) \
F(SetFlags, 1, 1) \
@@ -1019,7 +1004,6 @@
FOR_EACH_INTRINSIC_MATHS(F) \
FOR_EACH_INTRINSIC_NUMBERS(F) \
FOR_EACH_INTRINSIC_OBJECT(F) \
- FOR_EACH_INTRINSIC_OBSERVE(F) \
FOR_EACH_INTRINSIC_OPERATORS(F) \
FOR_EACH_INTRINSIC_PROXY(F) \
FOR_EACH_INTRINSIC_REGEXP(F) \
@@ -1110,6 +1094,12 @@
MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty(
Isolate* isolate, Handle<Object> object, Handle<Object> key);
+ MUST_USE_RESULT static MaybeHandle<Object> BasicJsonStringify(
+ Isolate* isolate, Handle<Object> object);
+
+ MUST_USE_RESULT static MaybeHandle<Object> BasicJsonStringifyString(
+ Isolate* isolate, Handle<String> string);
+
enum TypedArrayId {
// arrayIds below should be synchronized with typedarray.js natives.
ARRAY_ID_UINT8 = 1,
@@ -1129,11 +1119,6 @@
ElementsKind* fixed_elements_kind,
size_t* element_size);
- // Used in runtime.cc and hydrogen's VisitArrayLiteral.
- MUST_USE_RESULT static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
- Isolate* isolate, Handle<LiteralsArray> literals,
- Handle<FixedArray> elements);
-
static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate,
Handle<Object>);
};