OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2504 map = Map::Copy(map, "SlowAliasedArguments"); | 2504 map = Map::Copy(map, "SlowAliasedArguments"); |
2505 map->set_elements_kind(SLOW_SLOPPY_ARGUMENTS_ELEMENTS); | 2505 map->set_elements_kind(SLOW_SLOPPY_ARGUMENTS_ELEMENTS); |
2506 DCHECK_EQ(2, map->GetInObjectProperties()); | 2506 DCHECK_EQ(2, map->GetInObjectProperties()); |
2507 native_context()->set_slow_aliased_arguments_map(*map); | 2507 native_context()->set_slow_aliased_arguments_map(*map); |
2508 } | 2508 } |
2509 | 2509 |
2510 { // --- strict mode arguments map | 2510 { // --- strict mode arguments map |
2511 const PropertyAttributes attributes = | 2511 const PropertyAttributes attributes = |
2512 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 2512 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
2513 | 2513 |
2514 // Create the ThrowTypeError functions. | 2514 // Create the ThrowTypeError function. |
2515 Handle<AccessorPair> callee = factory->NewAccessorPair(); | 2515 Handle<AccessorPair> callee = factory->NewAccessorPair(); |
2516 Handle<AccessorPair> caller = factory->NewAccessorPair(); | |
2517 | 2516 |
2518 Handle<JSFunction> poison = GetStrictArgumentsPoisonFunction(); | 2517 Handle<JSFunction> poison = GetStrictArgumentsPoisonFunction(); |
2519 | 2518 |
2520 // Install the ThrowTypeError functions. | 2519 // Install the ThrowTypeError function. |
2521 callee->set_getter(*poison); | 2520 callee->set_getter(*poison); |
2522 callee->set_setter(*poison); | 2521 callee->set_setter(*poison); |
2523 caller->set_getter(*poison); | |
2524 caller->set_setter(*poison); | |
2525 | 2522 |
2526 // Create the map. Allocate one in-object field for length. | 2523 // Create the map. Allocate one in-object field for length. |
2527 Handle<Map> map = factory->NewMap( | 2524 Handle<Map> map = factory->NewMap( |
2528 JS_ARGUMENTS_TYPE, JSStrictArgumentsObject::kSize, FAST_ELEMENTS); | 2525 JS_ARGUMENTS_TYPE, JSStrictArgumentsObject::kSize, FAST_ELEMENTS); |
2529 // Create the descriptor array for the arguments object. | 2526 // Create the descriptor array for the arguments object. |
2530 Map::EnsureDescriptorSlack(map, 3); | 2527 Map::EnsureDescriptorSlack(map, 2); |
2531 | 2528 |
2532 { // length | 2529 { // length |
2533 DataDescriptor d(factory->length_string(), | 2530 DataDescriptor d(factory->length_string(), |
2534 JSStrictArgumentsObject::kLengthIndex, DONT_ENUM, | 2531 JSStrictArgumentsObject::kLengthIndex, DONT_ENUM, |
2535 Representation::Tagged()); | 2532 Representation::Tagged()); |
2536 map->AppendDescriptor(&d); | 2533 map->AppendDescriptor(&d); |
2537 } | 2534 } |
2538 { // callee | 2535 { // callee |
2539 AccessorConstantDescriptor d(factory->callee_string(), callee, | 2536 AccessorConstantDescriptor d(factory->callee_string(), callee, |
2540 attributes); | 2537 attributes); |
2541 map->AppendDescriptor(&d); | 2538 map->AppendDescriptor(&d); |
2542 } | 2539 } |
2543 { // caller | |
2544 AccessorConstantDescriptor d(factory->caller_string(), caller, | |
2545 attributes); | |
2546 map->AppendDescriptor(&d); | |
2547 } | |
caitp
2016/10/27 13:31:02
afaik this LGTM, but lets modify the tests rather
| |
2548 // @@iterator method is added later. | 2540 // @@iterator method is added later. |
2549 | 2541 |
2550 DCHECK_EQ(native_context()->object_function()->prototype(), | 2542 DCHECK_EQ(native_context()->object_function()->prototype(), |
2551 *isolate->initial_object_prototype()); | 2543 *isolate->initial_object_prototype()); |
2552 Map::SetPrototype(map, isolate->initial_object_prototype()); | 2544 Map::SetPrototype(map, isolate->initial_object_prototype()); |
2553 map->SetInObjectProperties(1); | 2545 map->SetInObjectProperties(1); |
2554 | 2546 |
2555 // Copy constructor from the sloppy arguments boilerplate. | 2547 // Copy constructor from the sloppy arguments boilerplate. |
2556 map->SetConstructor( | 2548 map->SetConstructor( |
2557 native_context()->sloppy_arguments_map()->GetConstructor()); | 2549 native_context()->sloppy_arguments_map()->GetConstructor()); |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4564 } | 4556 } |
4565 | 4557 |
4566 | 4558 |
4567 // Called when the top-level V8 mutex is destroyed. | 4559 // Called when the top-level V8 mutex is destroyed. |
4568 void Bootstrapper::FreeThreadResources() { | 4560 void Bootstrapper::FreeThreadResources() { |
4569 DCHECK(!IsActive()); | 4561 DCHECK(!IsActive()); |
4570 } | 4562 } |
4571 | 4563 |
4572 } // namespace internal | 4564 } // namespace internal |
4573 } // namespace v8 | 4565 } // namespace v8 |
OLD | NEW |