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