Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Side by Side Diff: src/bootstrapper.cc

Issue 2423053002: Install the 'name' property in classes at runtime (Closed)
Patch Set: Check for 'name' properties at parse-time Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 Handle<Context> result_; 286 Handle<Context> result_;
287 Handle<Context> native_context_; 287 Handle<Context> native_context_;
288 Handle<JSGlobalProxy> global_proxy_; 288 Handle<JSGlobalProxy> global_proxy_;
289 289
290 // Function maps. Function maps are created initially with a read only 290 // Function maps. Function maps are created initially with a read only
291 // prototype for the processing of JS builtins. Later the function maps are 291 // prototype for the processing of JS builtins. Later the function maps are
292 // replaced in order to make prototype writable. These are the final, writable 292 // replaced in order to make prototype writable. These are the final, writable
293 // prototype, maps. 293 // prototype, maps.
294 Handle<Map> sloppy_function_map_writable_prototype_; 294 Handle<Map> sloppy_function_map_writable_prototype_;
295 Handle<Map> strict_function_map_writable_prototype_; 295 Handle<Map> strict_function_map_writable_prototype_;
296 Handle<Map> class_function_map_;
296 Handle<JSFunction> strict_poison_function_; 297 Handle<JSFunction> strict_poison_function_;
297 Handle<JSFunction> restricted_function_properties_thrower_; 298 Handle<JSFunction> restricted_function_properties_thrower_;
298 299
299 BootstrapperActive active_; 300 BootstrapperActive active_;
300 friend class Bootstrapper; 301 friend class Bootstrapper;
301 }; 302 };
302 303
303 304
304 void Bootstrapper::Iterate(ObjectVisitor* v) { 305 void Bootstrapper::Iterate(ObjectVisitor* v) {
305 extensions_cache_.Iterate(v); 306 extensions_cache_.Iterate(v);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // Later the map is replaced with writable prototype map, allocated below. 671 // Later the map is replaced with writable prototype map, allocated below.
671 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap( 672 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap(
672 FUNCTION_WITH_READONLY_PROTOTYPE, empty); 673 FUNCTION_WITH_READONLY_PROTOTYPE, empty);
673 native_context()->set_strict_function_map(*strict_function_map); 674 native_context()->set_strict_function_map(*strict_function_map);
674 675
675 // The final map for the strict mode functions. Writeable prototype. 676 // The final map for the strict mode functions. Writeable prototype.
676 // This map is installed in MakeFunctionInstancePrototypeWritable. 677 // This map is installed in MakeFunctionInstancePrototypeWritable.
677 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap( 678 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap(
678 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); 679 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty);
679 680
681 // Allocate map for classes
682 class_function_map_ = factory()->CreateClassFunctionMap(empty);
683 native_context()->set_class_function_map(*class_function_map_);
684
680 // Now that the strict mode function map is available, set up the 685 // Now that the strict mode function map is available, set up the
681 // restricted "arguments" and "caller" getters. 686 // restricted "arguments" and "caller" getters.
682 AddRestrictedFunctionProperties(empty); 687 AddRestrictedFunctionProperties(empty);
683 } 688 }
684 689
685 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { 690 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) {
686 // Create iterator-related meta-objects. 691 // Create iterator-related meta-objects.
687 Handle<JSObject> iterator_prototype = 692 Handle<JSObject> iterator_prototype =
688 factory()->NewJSObject(isolate()->object_function(), TENURED); 693 factory()->NewJSObject(isolate()->object_function(), TENURED);
689 694
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 1260
1256 // Set the length for the function to satisfy ECMA-262. 1261 // Set the length for the function to satisfy ECMA-262.
1257 has_instance->shared()->set_length(1); 1262 has_instance->shared()->set_length(1);
1258 1263
1259 // Install the "constructor" property on the %FunctionPrototype%. 1264 // Install the "constructor" property on the %FunctionPrototype%.
1260 JSObject::AddProperty(prototype, factory->constructor_string(), 1265 JSObject::AddProperty(prototype, factory->constructor_string(),
1261 function_fun, DONT_ENUM); 1266 function_fun, DONT_ENUM);
1262 1267
1263 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); 1268 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun);
1264 strict_function_map_writable_prototype_->SetConstructor(*function_fun); 1269 strict_function_map_writable_prototype_->SetConstructor(*function_fun);
1270 class_function_map_->SetConstructor(*function_fun);
1265 } 1271 }
1266 1272
1267 { // --- A r r a y --- 1273 { // --- A r r a y ---
1268 Handle<JSFunction> array_function = 1274 Handle<JSFunction> array_function =
1269 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1275 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1270 isolate->initial_object_prototype(), 1276 isolate->initial_object_prototype(),
1271 Builtins::kArrayCode); 1277 Builtins::kArrayCode);
1272 array_function->shared()->DontAdaptArguments(); 1278 array_function->shared()->DontAdaptArguments();
1273 array_function->shared()->set_builtin_function_id(kArrayCode); 1279 array_function->shared()->set_builtin_function_id(kArrayCode);
1274 1280
(...skipping 3289 matching lines...) Expand 10 before | Expand all | Expand 10 after
4564 } 4570 }
4565 4571
4566 4572
4567 // Called when the top-level V8 mutex is destroyed. 4573 // Called when the top-level V8 mutex is destroyed.
4568 void Bootstrapper::FreeThreadResources() { 4574 void Bootstrapper::FreeThreadResources() {
4569 DCHECK(!IsActive()); 4575 DCHECK(!IsActive());
4570 } 4576 }
4571 4577
4572 } // namespace internal 4578 } // namespace internal
4573 } // namespace v8 4579 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698