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

Side by Side Diff: src/bootstrapper.cc

Issue 2423053002: Install the 'name' property in classes at runtime (Closed)
Patch Set: rebased 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
« no previous file with comments | « src/ast/ast-value-factory.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // Later the map is replaced with writable prototype map, allocated below. 678 // Later the map is replaced with writable prototype map, allocated below.
678 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap( 679 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap(
679 FUNCTION_WITH_READONLY_PROTOTYPE, empty); 680 FUNCTION_WITH_READONLY_PROTOTYPE, empty);
680 native_context()->set_strict_function_map(*strict_function_map); 681 native_context()->set_strict_function_map(*strict_function_map);
681 682
682 // The final map for the strict mode functions. Writeable prototype. 683 // The final map for the strict mode functions. Writeable prototype.
683 // This map is installed in MakeFunctionInstancePrototypeWritable. 684 // This map is installed in MakeFunctionInstancePrototypeWritable.
684 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap( 685 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap(
685 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); 686 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty);
686 687
688 // Allocate map for classes
689 class_function_map_ = factory()->CreateClassFunctionMap(empty);
690 native_context()->set_class_function_map(*class_function_map_);
691
687 // Now that the strict mode function map is available, set up the 692 // Now that the strict mode function map is available, set up the
688 // restricted "arguments" and "caller" getters. 693 // restricted "arguments" and "caller" getters.
689 AddRestrictedFunctionProperties(empty); 694 AddRestrictedFunctionProperties(empty);
690 } 695 }
691 696
692 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { 697 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) {
693 // Create iterator-related meta-objects. 698 // Create iterator-related meta-objects.
694 Handle<JSObject> iterator_prototype = 699 Handle<JSObject> iterator_prototype =
695 factory()->NewJSObject(isolate()->object_function(), TENURED); 700 factory()->NewJSObject(isolate()->object_function(), TENURED);
696 701
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 1265
1261 // Set the length for the function to satisfy ECMA-262. 1266 // Set the length for the function to satisfy ECMA-262.
1262 has_instance->shared()->set_length(1); 1267 has_instance->shared()->set_length(1);
1263 1268
1264 // Install the "constructor" property on the %FunctionPrototype%. 1269 // Install the "constructor" property on the %FunctionPrototype%.
1265 JSObject::AddProperty(prototype, factory->constructor_string(), 1270 JSObject::AddProperty(prototype, factory->constructor_string(),
1266 function_fun, DONT_ENUM); 1271 function_fun, DONT_ENUM);
1267 1272
1268 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); 1273 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun);
1269 strict_function_map_writable_prototype_->SetConstructor(*function_fun); 1274 strict_function_map_writable_prototype_->SetConstructor(*function_fun);
1275 class_function_map_->SetConstructor(*function_fun);
1270 } 1276 }
1271 1277
1272 { // --- A r r a y --- 1278 { // --- A r r a y ---
1273 Handle<JSFunction> array_function = 1279 Handle<JSFunction> array_function =
1274 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1280 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1275 isolate->initial_object_prototype(), 1281 isolate->initial_object_prototype(),
1276 Builtins::kArrayCode); 1282 Builtins::kArrayCode);
1277 array_function->shared()->DontAdaptArguments(); 1283 array_function->shared()->DontAdaptArguments();
1278 array_function->shared()->set_builtin_function_id(kArrayCode); 1284 array_function->shared()->set_builtin_function_id(kArrayCode);
1279 1285
(...skipping 3337 matching lines...) Expand 10 before | Expand all | Expand 10 after
4617 } 4623 }
4618 4624
4619 4625
4620 // Called when the top-level V8 mutex is destroyed. 4626 // Called when the top-level V8 mutex is destroyed.
4621 void Bootstrapper::FreeThreadResources() { 4627 void Bootstrapper::FreeThreadResources() {
4622 DCHECK(!IsActive()); 4628 DCHECK(!IsActive());
4623 } 4629 }
4624 4630
4625 } // namespace internal 4631 } // namespace internal
4626 } // namespace v8 4632 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast-value-factory.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698