diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 2936f01c38..12ba1a9555 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -165,7 +165,7 @@ class Genesis BASE_EMBEDDED { void CreateJSProxyMaps(); // Make the "arguments" and "caller" properties throw a TypeError on access. - void AddRestrictedFunctionProperties(Handle map); + void AddRestrictedFunctionProperties(Handle empty); // Creates the global objects using the global proxy and the template passed // in through the API. We call this regardless of whether we are building a @@ -609,9 +609,6 @@ Handle Genesis::CreateEmptyFunction(Isolate* isolate) { Map::SetPrototype(sloppy_function_without_prototype_map, empty_function); Map::SetPrototype(sloppy_function_map_writable_prototype_, empty_function); - // ES6 draft 03-17-2015, section 8.2.2 step 12 - AddRestrictedFunctionProperties(empty_function_map); - return empty_function; } @@ -666,7 +663,7 @@ Handle Genesis::GetThrowTypeErrorIntrinsic( factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("ThrowTypeError")); Handle code(isolate()->builtins()->builtin(builtin_name)); Handle function = - factory()->NewFunctionWithoutPrototype(name, code); + factory()->NewFunctionWithoutPrototype(name, code, true); function->shared()->DontAdaptArguments(); // %ThrowTypeError% must not have a name property. @@ -739,6 +736,10 @@ void Genesis::CreateStrictModeFunctionMaps(Handle empty) { // This map is installed in MakeFunctionInstancePrototypeWritable. strict_function_map_writable_prototype_ = CreateStrictFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); + + // Now that the strict mode function map is available, set up the + // restricted "arguments" and "caller" getters. + AddRestrictedFunctionProperties(empty); } void Genesis::CreateIteratorMaps(Handle empty) { @@ -868,14 +869,14 @@ static void ReplaceAccessors(Handle map, descriptors->Replace(idx, &descriptor); } - -void Genesis::AddRestrictedFunctionProperties(Handle map) { +void Genesis::AddRestrictedFunctionProperties(Handle empty) { PropertyAttributes rw_attribs = static_cast(DONT_ENUM); Handle thrower = GetRestrictedFunctionPropertiesThrower(); Handle accessors = factory()->NewAccessorPair(); accessors->set_getter(*thrower); accessors->set_setter(*thrower); + Handle map(empty->map()); ReplaceAccessors(map, factory()->arguments_string(), rw_attribs, accessors); ReplaceAccessors(map, factory()->caller_string(), rw_attribs, accessors); } diff --git a/test/test262/test262.status b/test/test262/test262.status index 08966fdc4d..3fd137f646 100644 --- a/test/test262/test262.status +++ b/test/test262/test262.status @@ -230,10 +230,6 @@ 'built-ins/TypedArray/prototype/toString/detached-buffer': [FAIL], 'built-ins/TypedArray/prototype/values/detached-buffer': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=4925 - 'built-ins/ThrowTypeError/forbidden-arguments': [FAIL], - 'built-ins/ThrowTypeError/forbidden-caller': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=4034 'built-ins/ThrowTypeError/unique-per-realm-function-proto': [FAIL],