Commit 38d46c03 authored by yangguo's avatar yangguo Committed by Commit bot

Native context: alpha sort slots and remove boilerplate.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/1307963002

Cr-Commit-Position: refs/heads/master@{#30319}
parent cc97e524
...@@ -6948,7 +6948,7 @@ class Internals { ...@@ -6948,7 +6948,7 @@ class Internals {
static const int kJSObjectHeaderSize = 3 * kApiPointerSize; static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
static const int kContextHeaderSize = 2 * kApiPointerSize; static const int kContextHeaderSize = 2 * kApiPointerSize;
static const int kContextEmbedderDataIndex = 27; static const int kContextEmbedderDataIndex = 5;
static const int kFullStringRepresentationMask = 0x07; static const int kFullStringRepresentationMask = 0x07;
static const int kStringEncodingMask = 0x4; static const int kStringEncodingMask = 0x4;
static const int kExternalTwoByteRepresentationTag = 0x02; static const int kExternalTwoByteRepresentationTag = 0x02;
......
...@@ -171,7 +171,7 @@ utils.Export(function(to) { ...@@ -171,7 +171,7 @@ utils.Export(function(to) {
$arrayValues = ArrayValues; $arrayValues = ArrayValues;
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.ArrayValues = ArrayValues; to["array_values_iterator"] = ArrayValues;
}); });
}) })
...@@ -263,9 +263,6 @@ class AstValue : public ZoneObject { ...@@ -263,9 +263,6 @@ class AstValue : public ZoneObject {
F(is_construct_call, "_IsConstructCall") \ F(is_construct_call, "_IsConstructCall") \
F(is_spec_object, "_IsSpecObject") \ F(is_spec_object, "_IsSpecObject") \
F(let, "let") \ F(let, "let") \
F(make_reference_error, "MakeReferenceError") \
F(make_syntax_error, "MakeSyntaxError") \
F(make_type_error, "MakeTypeError") \
F(native, "native") \ F(native, "native") \
F(new_target, ".new.target") \ F(new_target, ".new.target") \
F(next, "next") \ F(next, "next") \
......
...@@ -1752,83 +1752,18 @@ void Genesis::InitializeBuiltinTypedArrays() { ...@@ -1752,83 +1752,18 @@ void Genesis::InitializeBuiltinTypedArrays() {
} }
#define INSTALL_NATIVE(Type, name, var) \ #define INSTALL_NATIVE(index, Type, name) \
Handle<Object> var##_native = \ Handle<Object> name##_native = \
Object::GetProperty(isolate, container, name, STRICT).ToHandleChecked(); \ Object::GetProperty(isolate, container, #name, STRICT) \
DCHECK(var##_native->Is##Type()); \ .ToHandleChecked(); \
native_context->set_##var(Type::cast(*var##_native)); DCHECK(name##_native->Is##Type()); \
native_context->set_##name(Type::cast(*name##_native));
void Bootstrapper::ImportNatives(Isolate* isolate, Handle<JSObject> container) { void Bootstrapper::ImportNatives(Isolate* isolate, Handle<JSObject> container) {
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<Context> native_context = isolate->native_context(); Handle<Context> native_context = isolate->native_context();
INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); NATIVE_CONTEXT_IMPORTED_FIELDS(INSTALL_NATIVE)
INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
INSTALL_NATIVE(JSFunction, "NoSideEffectToString",
no_side_effect_to_string_fun);
INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
INSTALL_NATIVE(JSFunction, "ToLength", to_length_fun);
INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun);
INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor",
to_complete_property_descriptor);
INSTALL_NATIVE(JSFunction, "ObjectDefineOwnProperty",
object_define_own_property);
INSTALL_NATIVE(JSFunction, "ObjectGetOwnPropertyDescriptor",
object_get_own_property_descriptor);
INSTALL_NATIVE(JSFunction, "MessageGetLineNumber", message_get_line_number);
INSTALL_NATIVE(JSFunction, "MessageGetColumnNumber",
message_get_column_number);
INSTALL_NATIVE(JSFunction, "MessageGetSourceLine", message_get_source_line);
INSTALL_NATIVE(JSObject, "StackOverflowBoilerplate",
stack_overflow_boilerplate);
INSTALL_NATIVE(JSFunction, "JsonSerializeAdapter", json_serialize_adapter);
INSTALL_NATIVE(JSFunction, "Error", error_function);
INSTALL_NATIVE(JSFunction, "EvalError", eval_error_function);
INSTALL_NATIVE(JSFunction, "RangeError", range_error_function);
INSTALL_NATIVE(JSFunction, "ReferenceError", reference_error_function);
INSTALL_NATIVE(JSFunction, "SyntaxError", syntax_error_function);
INSTALL_NATIVE(JSFunction, "TypeError", type_error_function);
INSTALL_NATIVE(JSFunction, "URIError", uri_error_function);
INSTALL_NATIVE(JSFunction, "MakeError", make_error_function);
INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
INSTALL_NATIVE(JSFunction, "PromiseThen", promise_then);
INSTALL_NATIVE(JSFunction, "PromiseHasUserDefinedRejectHandler",
promise_has_user_defined_reject_handler);
INSTALL_NATIVE(JSFunction, "ObserveNotifyChange", observers_notify_change);
INSTALL_NATIVE(JSFunction, "ObserveEnqueueSpliceRecord",
observers_enqueue_splice);
INSTALL_NATIVE(JSFunction, "ObserveBeginPerformSplice",
observers_begin_perform_splice);
INSTALL_NATIVE(JSFunction, "ObserveEndPerformSplice",
observers_end_perform_splice);
INSTALL_NATIVE(JSFunction, "ObserveNativeObjectObserve",
native_object_observe);
INSTALL_NATIVE(JSFunction, "ObserveNativeObjectGetNotifier",
native_object_get_notifier);
INSTALL_NATIVE(JSFunction, "ObserveNativeObjectNotifierPerformChange",
native_object_notifier_perform_change);
INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator);
INSTALL_NATIVE(JSFunction, "MapGet", map_get);
INSTALL_NATIVE(JSFunction, "MapSet", map_set);
INSTALL_NATIVE(JSFunction, "MapHas", map_has);
INSTALL_NATIVE(JSFunction, "MapDelete", map_delete);
INSTALL_NATIVE(JSFunction, "SetAdd", set_add);
INSTALL_NATIVE(JSFunction, "SetHas", set_has);
INSTALL_NATIVE(JSFunction, "SetDelete", set_delete);
INSTALL_NATIVE(JSFunction, "MapFromArray", map_from_array);
INSTALL_NATIVE(JSFunction, "SetFromArray", set_from_array);
} }
...@@ -1865,10 +1800,7 @@ static void InstallExperimentalNatives_harmony_proxies( ...@@ -1865,10 +1800,7 @@ static void InstallExperimentalNatives_harmony_proxies(
Isolate* isolate, Handle<Context> native_context, Isolate* isolate, Handle<Context> native_context,
Handle<JSObject> container) { Handle<JSObject> container) {
if (FLAG_harmony_proxies) { if (FLAG_harmony_proxies) {
INSTALL_NATIVE(JSFunction, "ProxyDerivedGetTrap", derived_get_trap); NATIVE_CONTEXT_IMPORTED_FIELDS_FOR_PROXY(INSTALL_NATIVE)
INSTALL_NATIVE(JSFunction, "ProxyDerivedHasTrap", derived_has_trap);
INSTALL_NATIVE(JSFunction, "ProxyDerivedSetTrap", derived_set_trap);
INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
} }
} }
......
...@@ -503,15 +503,15 @@ function SetFromArray(array) { ...@@ -503,15 +503,15 @@ function SetFromArray(array) {
// Exports // Exports
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.MapGet = MapGet; to["map_get"] = MapGet;
to.MapSet = MapSet; to["map_set"] = MapSet;
to.MapHas = MapHas; to["map_has"] = MapHas;
to.MapDelete = MapDelete; to["map_delete"] = MapDelete;
to.SetAdd = SetAdd; to["set_add"] = SetAdd;
to.SetHas = SetHas; to["set_has"] = SetHas;
to.SetDelete = SetDelete; to["set_delete"] = SetDelete;
to.MapFromArray = MapFromArray; to["map_from_array"] = MapFromArray;
to.SetFromArray = SetFromArray; to["set_from_array"]= SetFromArray;
}); });
}) })
This diff is collapsed.
...@@ -884,7 +884,7 @@ utils.InstallFunctions(GlobalDate.prototype, DONT_ENUM, [ ...@@ -884,7 +884,7 @@ utils.InstallFunctions(GlobalDate.prototype, DONT_ENUM, [
]); ]);
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.CreateDate = CreateDate; to["create_date_fun"] = CreateDate;
}); });
}) })
...@@ -1265,7 +1265,7 @@ void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { ...@@ -1265,7 +1265,7 @@ void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) {
TagObject(context->normalized_map_cache(), "(context norm. map cache)"); TagObject(context->normalized_map_cache(), "(context norm. map cache)");
TagObject(context->runtime_context(), "(runtime context)"); TagObject(context->runtime_context(), "(runtime context)");
TagObject(context->embedder_data(), "(context data)"); TagObject(context->embedder_data(), "(context data)");
NATIVE_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD); NATIVE_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD)
EXTRACT_CONTEXT_FIELD(OPTIMIZED_FUNCTIONS_LIST, unused, EXTRACT_CONTEXT_FIELD(OPTIMIZED_FUNCTIONS_LIST, unused,
optimized_functions_list); optimized_functions_list);
EXTRACT_CONTEXT_FIELD(OPTIMIZED_CODE_LIST, unused, optimized_code_list); EXTRACT_CONTEXT_FIELD(OPTIMIZED_CODE_LIST, unused, optimized_code_list);
......
...@@ -253,7 +253,7 @@ function JsonSerializeAdapter(key, object) { ...@@ -253,7 +253,7 @@ function JsonSerializeAdapter(key, object) {
} }
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.JsonSerializeAdapter = JsonSerializeAdapter; to["json_serialize_adapter"] = JsonSerializeAdapter;
}); });
}) })
...@@ -1017,21 +1017,21 @@ captureStackTrace = function captureStackTrace(obj, cons_opt) { ...@@ -1017,21 +1017,21 @@ captureStackTrace = function captureStackTrace(obj, cons_opt) {
GlobalError.captureStackTrace = captureStackTrace; GlobalError.captureStackTrace = captureStackTrace;
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.Error = GlobalError; to["error_function"] = GlobalError;
to.EvalError = GlobalEvalError; to["eval_error_function"] = GlobalEvalError;
to.RangeError = GlobalRangeError; to["get_stack_trace_line_fun"] = GetStackTraceLine;
to.ReferenceError = GlobalReferenceError; to["make_error_function"] = MakeGenericError;
to.SyntaxError = GlobalSyntaxError; to["message_get_column_number"] = GetColumnNumber;
to.TypeError = GlobalTypeError; to["message_get_line_number"] = GetLineNumber;
to.URIError = GlobalURIError; to["message_get_source_line"] = GetSourceLine;
to.GetStackTraceLine = GetStackTraceLine; to["no_side_effect_to_string_fun"] = NoSideEffectToString;
to.NoSideEffectToString = NoSideEffectToString; to["range_error_function"] = GlobalRangeError;
to.ToDetailString = ToDetailString; to["reference_error_function"] = GlobalReferenceError;
to.MakeError = MakeGenericError; to["stack_overflow_boilerplate"] = StackOverflowBoilerplate;
to.MessageGetLineNumber = GetLineNumber; to["syntax_error_function"] = GlobalSyntaxError;
to.MessageGetColumnNumber = GetColumnNumber; to["to_detail_string_fun"] = ToDetailString;
to.MessageGetSourceLine = GetSourceLine; to["type_error_function"] = GlobalTypeError;
to.StackOverflowBoilerplate = StackOverflowBoilerplate; to["uri_error_function"] = GlobalURIError;
}); });
}); });
...@@ -704,14 +704,14 @@ $observeBeginPerformSplice = BeginPerformSplice; ...@@ -704,14 +704,14 @@ $observeBeginPerformSplice = BeginPerformSplice;
$observeEndPerformSplice = EndPerformSplice; $observeEndPerformSplice = EndPerformSplice;
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.ObserveNotifyChange = NotifyChange; to["native_object_get_notifier"] = NativeObjectGetNotifier;
to.ObserveEnqueueSpliceRecord = EnqueueSpliceRecord; to["native_object_notifier_perform_change"] =
to.ObserveBeginPerformSplice = BeginPerformSplice;
to.ObserveEndPerformSplice = EndPerformSplice;
to.ObserveNativeObjectObserve = NativeObjectObserve;
to.ObserveNativeObjectGetNotifier = NativeObjectGetNotifier;
to.ObserveNativeObjectNotifierPerformChange =
NativeObjectNotifierPerformChange; NativeObjectNotifierPerformChange;
to["native_object_observe"] = NativeObjectObserve;
to["observers_begin_perform_splice"] = BeginPerformSplice;
to["observers_end_perform_splice"] = EndPerformSplice;
to["observers_enqueue_splice"] = EnqueueSpliceRecord;
to["observers_notify_change"] = NotifyChange;
}); });
}) })
...@@ -380,13 +380,14 @@ utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [ ...@@ -380,13 +380,14 @@ utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [
]); ]);
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.PromiseCreate = PromiseCreate; to["promise_catch"] = PromiseCatch;
to.PromiseResolve = PromiseResolve; to["promise_chain"] = PromiseChain;
to.PromiseReject = PromiseReject; to["promise_create"] = PromiseCreate;
to.PromiseChain = PromiseChain; to["promise_has_user_defined_reject_handler"] =
to.PromiseCatch = PromiseCatch; PromiseHasUserDefinedRejectHandler;
to.PromiseThen = PromiseThen; to["promise_reject"] = PromiseReject;
to.PromiseHasUserDefinedRejectHandler = PromiseHasUserDefinedRejectHandler; to["promise_resolve"] = PromiseResolve;
to["promise_then"] = PromiseThen;
}); });
}) })
...@@ -201,10 +201,10 @@ utils.Export(function(to) { ...@@ -201,10 +201,10 @@ utils.Export(function(to) {
}); });
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.ProxyDerivedGetTrap = DerivedGetTrap; to["derived_get_trap"] = DerivedGetTrap;
to.ProxyDerivedHasTrap = DerivedHasTrap; to["derived_has_trap"] = DerivedHasTrap;
to.ProxyDerivedSetTrap = DerivedSetTrap; to["derived_set_trap"] = DerivedSetTrap;
to.ProxyEnumerate = ProxyEnumerate; to["proxy_enumerate"] = ProxyEnumerate;
}); });
}) })
...@@ -915,10 +915,10 @@ $toString = ToString; ...@@ -915,10 +915,10 @@ $toString = ToString;
}); });
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.ToNumber = ToNumber; to["to_integer_fun"] = ToInteger;
to.ToString = ToString; to["to_length_fun"] = ToLength;
to.ToInteger = ToInteger; to["to_number_fun"] = ToNumber;
to.ToLength = ToLength; to["to_string_fun"] = ToString;
}); });
utils.Export(function(to) { utils.Export(function(to) {
......
...@@ -1810,10 +1810,10 @@ utils.Export(function(to) { ...@@ -1810,10 +1810,10 @@ utils.Export(function(to) {
}); });
utils.ExportToRuntime(function(to) { utils.ExportToRuntime(function(to) {
to.GlobalEval = GlobalEval; to["global_eval_fun"] = GlobalEval;
to.ObjectDefineOwnProperty = DefineOwnPropertyFromAPI; to["object_define_own_property"] = DefineOwnPropertyFromAPI;
to.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor; to["object_get_own_property_descriptor"] = ObjectGetOwnPropertyDescriptor;
to.ToCompletePropertyDescriptor = ToCompletePropertyDescriptor; to["to_complete_property_descriptor"] = ToCompletePropertyDescriptor;
}); });
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment