| Index: src/bootstrapper.cc
|
| ===================================================================
|
| --- src/bootstrapper.cc (revision 10404)
|
| +++ src/bootstrapper.cc (working copy)
|
| @@ -264,13 +264,13 @@
|
| Handle<Map> CreateStrictModeFunctionMap(
|
| PrototypePropertyMode prototype_mode,
|
| Handle<JSFunction> empty_function,
|
| - Handle<FixedArray> arguments_callbacks,
|
| - Handle<FixedArray> caller_callbacks);
|
| + Handle<AccessorPair> arguments_callbacks,
|
| + Handle<AccessorPair> caller_callbacks);
|
|
|
| Handle<DescriptorArray> ComputeStrictFunctionInstanceDescriptor(
|
| PrototypePropertyMode propertyMode,
|
| - Handle<FixedArray> arguments,
|
| - Handle<FixedArray> caller);
|
| + Handle<AccessorPair> arguments,
|
| + Handle<AccessorPair> caller);
|
|
|
| static bool CompileBuiltin(Isolate* isolate, int index);
|
| static bool CompileExperimentalBuiltin(Isolate* isolate, int index);
|
| @@ -378,7 +378,9 @@
|
| } else {
|
| attributes = DONT_ENUM;
|
| }
|
| - SetLocalPropertyNoThrow(target, symbol, function, attributes);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + target, symbol, function, attributes));
|
| if (is_ecma_native) {
|
| function->shared()->set_instance_class_name(*symbol);
|
| }
|
| @@ -538,8 +540,8 @@
|
|
|
| Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor(
|
| PrototypePropertyMode prototypeMode,
|
| - Handle<FixedArray> arguments,
|
| - Handle<FixedArray> caller) {
|
| + Handle<AccessorPair> arguments,
|
| + Handle<AccessorPair> caller) {
|
| Handle<DescriptorArray> descriptors =
|
| factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE
|
| ? 4
|
| @@ -600,7 +602,7 @@
|
| throw_type_error_function->shared()->set_code(*code);
|
| throw_type_error_function->shared()->DontAdaptArguments();
|
|
|
| - PreventExtensions(throw_type_error_function);
|
| + JSObject::PreventExtensions(throw_type_error_function);
|
| }
|
| return throw_type_error_function;
|
| }
|
| @@ -609,8 +611,8 @@
|
| Handle<Map> Genesis::CreateStrictModeFunctionMap(
|
| PrototypePropertyMode prototype_mode,
|
| Handle<JSFunction> empty_function,
|
| - Handle<FixedArray> arguments_callbacks,
|
| - Handle<FixedArray> caller_callbacks) {
|
| + Handle<AccessorPair> arguments_callbacks,
|
| + Handle<AccessorPair> caller_callbacks) {
|
| Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
|
| Handle<DescriptorArray> descriptors =
|
| ComputeStrictFunctionInstanceDescriptor(prototype_mode,
|
| @@ -627,8 +629,8 @@
|
| // Create the callbacks arrays for ThrowTypeError functions.
|
| // The get/set callacks are filled in after the maps are created below.
|
| Factory* factory = empty->GetIsolate()->factory();
|
| - Handle<FixedArray> arguments = factory->NewFixedArray(2, TENURED);
|
| - Handle<FixedArray> caller = factory->NewFixedArray(2, TENURED);
|
| + Handle<AccessorPair> arguments(factory->NewAccessorPair());
|
| + Handle<AccessorPair> caller(factory->NewAccessorPair());
|
|
|
| // Allocate map for the strict mode function instances.
|
| Handle<Map> strict_mode_function_instance_map =
|
| @@ -663,11 +665,11 @@
|
| Handle<JSFunction> throw_function =
|
| GetThrowTypeErrorFunction();
|
|
|
| - // Complete the callback fixed arrays.
|
| - arguments->set(0, *throw_function);
|
| - arguments->set(1, *throw_function);
|
| - caller->set(0, *throw_function);
|
| - caller->set(1, *throw_function);
|
| + // Complete the callbacks.
|
| + arguments->set_getter(*throw_function);
|
| + arguments->set_setter(*throw_function);
|
| + caller->set_getter(*throw_function);
|
| + caller->set_setter(*throw_function);
|
| }
|
|
|
|
|
| @@ -753,11 +755,10 @@
|
| Handle<JSObject> prototype =
|
| Handle<JSObject>(
|
| JSObject::cast(js_global_function->instance_prototype()));
|
| - SetLocalPropertyNoThrow(
|
| - prototype,
|
| - factory()->constructor_symbol(),
|
| - isolate()->object_function(),
|
| - NONE);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate(),
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + prototype, factory()->constructor_symbol(),
|
| + isolate()->object_function(), NONE));
|
| } else {
|
| Handle<FunctionTemplateInfo> js_global_constructor(
|
| FunctionTemplateInfo::cast(js_global_template->constructor()));
|
| @@ -834,7 +835,7 @@
|
| factory()->LookupAsciiSymbol("global"),
|
| inner_global,
|
| attributes);
|
| - // Setup the reference from the global object to the builtins object.
|
| + // Set up the reference from the global object to the builtins object.
|
| JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global);
|
| TransferNamedProperties(inner_global_from_snapshot, inner_global);
|
| TransferIndexedProperties(inner_global_from_snapshot, inner_global);
|
| @@ -863,8 +864,10 @@
|
| Heap* heap = isolate->heap();
|
|
|
| Handle<String> object_name = Handle<String>(heap->Object_symbol());
|
| - SetLocalPropertyNoThrow(inner_global, object_name,
|
| - isolate->object_function(), DONT_ENUM);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + inner_global, object_name,
|
| + isolate->object_function(), DONT_ENUM));
|
|
|
| Handle<JSObject> global = Handle<JSObject>(global_context()->global());
|
|
|
| @@ -1046,14 +1049,15 @@
|
|
|
| { // -- J S O N
|
| Handle<String> name = factory->NewStringFromAscii(CStrVector("JSON"));
|
| - Handle<JSFunction> cons = factory->NewFunction(
|
| - name,
|
| - factory->the_hole_value());
|
| + Handle<JSFunction> cons = factory->NewFunction(name,
|
| + factory->the_hole_value());
|
| cons->SetInstancePrototype(global_context()->initial_object_prototype());
|
| cons->SetInstanceClassName(*name);
|
| Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
|
| ASSERT(json_object->IsJSObject());
|
| - SetLocalPropertyNoThrow(global, name, json_object, DONT_ENUM);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + global, name, json_object, DONT_ENUM));
|
| global_context()->set_json_object(*json_object);
|
| }
|
|
|
| @@ -1083,12 +1087,14 @@
|
| global_context()->set_arguments_boilerplate(*result);
|
| // Note: length must be added as the first property and
|
| // callee must be added as the second property.
|
| - SetLocalPropertyNoThrow(result, factory->length_symbol(),
|
| - factory->undefined_value(),
|
| - DONT_ENUM);
|
| - SetLocalPropertyNoThrow(result, factory->callee_symbol(),
|
| - factory->undefined_value(),
|
| - DONT_ENUM);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + result, factory->length_symbol(),
|
| + factory->undefined_value(), DONT_ENUM));
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + result, factory->callee_symbol(),
|
| + factory->undefined_value(), DONT_ENUM));
|
|
|
| #ifdef DEBUG
|
| LookupResult lookup(isolate);
|
| @@ -1136,17 +1142,17 @@
|
| static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
|
|
|
| // Create the ThrowTypeError functions.
|
| - Handle<FixedArray> callee = factory->NewFixedArray(2, TENURED);
|
| - Handle<FixedArray> caller = factory->NewFixedArray(2, TENURED);
|
| + Handle<AccessorPair> callee = factory->NewAccessorPair();
|
| + Handle<AccessorPair> caller = factory->NewAccessorPair();
|
|
|
| Handle<JSFunction> throw_function =
|
| GetThrowTypeErrorFunction();
|
|
|
| // Install the ThrowTypeError functions.
|
| - callee->set(0, *throw_function);
|
| - callee->set(1, *throw_function);
|
| - caller->set(0, *throw_function);
|
| - caller->set(1, *throw_function);
|
| + callee->set_getter(*throw_function);
|
| + callee->set_setter(*throw_function);
|
| + caller->set_getter(*throw_function);
|
| + caller->set_setter(*throw_function);
|
|
|
| // Create the descriptor array for the arguments object.
|
| Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3);
|
| @@ -1183,9 +1189,10 @@
|
| global_context()->set_strict_mode_arguments_boilerplate(*result);
|
|
|
| // Add length property only for strict mode boilerplate.
|
| - SetLocalPropertyNoThrow(result, factory->length_symbol(),
|
| - factory->undefined_value(),
|
| - DONT_ENUM);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + result, factory->length_symbol(),
|
| + factory->undefined_value(), DONT_ENUM));
|
|
|
| #ifdef DEBUG
|
| LookupResult lookup(isolate);
|
| @@ -1353,7 +1360,7 @@
|
| if (cache != NULL) cache->Add(name, function_info);
|
| }
|
|
|
| - // Setup the function context. Conceptually, we should clone the
|
| + // Set up the function context. Conceptually, we should clone the
|
| // function before overwriting the context but since we're in a
|
| // single-threaded environment it is not strictly necessary.
|
| ASSERT(top_context->IsGlobalContext());
|
| @@ -1440,7 +1447,7 @@
|
| builtins->set_global_context(*global_context());
|
| builtins->set_global_receiver(*builtins);
|
|
|
| - // Setup the 'global' properties of the builtins object. The
|
| + // Set up the 'global' properties of the builtins object. The
|
| // 'global' property that refers to the global object is the only
|
| // way to get from code running in the builtins context to the
|
| // global object.
|
| @@ -1448,9 +1455,11 @@
|
| static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
|
| Handle<String> global_symbol = factory()->LookupAsciiSymbol("global");
|
| Handle<Object> global_obj(global_context()->global());
|
| - SetLocalPropertyNoThrow(builtins, global_symbol, global_obj, attributes);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate(),
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + builtins, global_symbol, global_obj, attributes));
|
|
|
| - // Setup the reference from the global object to the builtins object.
|
| + // Set up the reference from the global object to the builtins object.
|
| JSGlobalObject::cast(global_context()->global())->set_builtins(*builtins);
|
|
|
| // Create a bridge function that has context in the global context.
|
| @@ -1674,7 +1683,7 @@
|
| InstallNativeFunctions();
|
|
|
| // Store the map for the string prototype after the natives has been compiled
|
| - // and the String function has been setup.
|
| + // and the String function has been set up.
|
| Handle<JSFunction> string_function(global_context()->string_function());
|
| ASSERT(JSObject::cast(
|
| string_function->initial_map()->prototype())->HasFastProperties());
|
| @@ -1911,25 +1920,28 @@
|
|
|
|
|
| void Genesis::InstallSpecialObjects(Handle<Context> global_context) {
|
| - Factory* factory = global_context->GetIsolate()->factory();
|
| + Isolate* isolate = global_context->GetIsolate();
|
| + Factory* factory = isolate->factory();
|
| HandleScope scope;
|
| - Handle<JSGlobalObject> js_global(
|
| - JSGlobalObject::cast(global_context->global()));
|
| + Handle<JSGlobalObject> global(JSGlobalObject::cast(global_context->global()));
|
| // Expose the natives in global if a name for it is specified.
|
| if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
|
| - Handle<String> natives_string =
|
| - factory->LookupAsciiSymbol(FLAG_expose_natives_as);
|
| - SetLocalPropertyNoThrow(js_global, natives_string,
|
| - Handle<JSObject>(js_global->builtins()), DONT_ENUM);
|
| + Handle<String> natives = factory->LookupAsciiSymbol(FLAG_expose_natives_as);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + global, natives,
|
| + Handle<JSObject>(global->builtins()),
|
| + DONT_ENUM));
|
| }
|
|
|
| - Handle<Object> Error = GetProperty(js_global, "Error");
|
| + Handle<Object> Error = GetProperty(global, "Error");
|
| if (Error->IsJSObject()) {
|
| Handle<String> name = factory->LookupAsciiSymbol("stackTraceLimit");
|
| - SetLocalPropertyNoThrow(Handle<JSObject>::cast(Error),
|
| - name,
|
| - Handle<Smi>(Smi::FromInt(FLAG_stack_trace_limit)),
|
| - NONE);
|
| + Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit));
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + Handle<JSObject>::cast(Error), name,
|
| + stack_trace_limit, NONE));
|
| }
|
|
|
| #ifdef ENABLE_DEBUGGER_SUPPORT
|
| @@ -1948,7 +1960,9 @@
|
| Handle<String> debug_string =
|
| factory->LookupAsciiSymbol(FLAG_expose_debug_as);
|
| Handle<Object> global_proxy(debug->debug_context()->global_proxy());
|
| - SetLocalPropertyNoThrow(js_global, debug_string, global_proxy, DONT_ENUM);
|
| + CHECK_NOT_EMPTY_HANDLE(isolate,
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + global, debug_string, global_proxy, DONT_ENUM));
|
| }
|
| #endif
|
| }
|
| @@ -2164,7 +2178,9 @@
|
| Handle<String> key = Handle<String>(descs->GetKey(i));
|
| int index = descs->GetFieldIndex(i);
|
| Handle<Object> value = Handle<Object>(from->FastPropertyAt(index));
|
| - SetLocalPropertyNoThrow(to, key, value, details.attributes());
|
| + CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(),
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + to, key, value, details.attributes()));
|
| break;
|
| }
|
| case CONSTANT_FUNCTION: {
|
| @@ -2172,7 +2188,9 @@
|
| Handle<String> key = Handle<String>(descs->GetKey(i));
|
| Handle<JSFunction> fun =
|
| Handle<JSFunction>(descs->GetConstantFunction(i));
|
| - SetLocalPropertyNoThrow(to, key, fun, details.attributes());
|
| + CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(),
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + to, key, fun, details.attributes()));
|
| break;
|
| }
|
| case CALLBACKS: {
|
| @@ -2187,7 +2205,7 @@
|
| Handle<Object> callbacks(descs->GetCallbacksObject(i));
|
| PropertyDetails d =
|
| PropertyDetails(details.attributes(), CALLBACKS, details.index());
|
| - SetNormalizedProperty(to, key, callbacks, d);
|
| + JSObject::SetNormalizedProperty(to, key, callbacks, d);
|
| break;
|
| }
|
| case MAP_TRANSITION:
|
| @@ -2224,7 +2242,9 @@
|
| value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value());
|
| }
|
| PropertyDetails details = properties->DetailsAt(i);
|
| - SetLocalPropertyNoThrow(to, key, value, details.attributes());
|
| + CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(),
|
| + JSObject::SetLocalPropertyIgnoreAttributes(
|
| + to, key, value, details.attributes()));
|
| }
|
| }
|
| }
|
|
|