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

Side by Side Diff: src/bootstrapper.cc

Issue 2511223003: [turbofan] Properly optimize instanceof (even in the presence of @@hasInstance). (Closed)
Patch Set: Created 4 years, 1 month 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 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 Builtins::kFunctionPrototypeCall, 1, false); 1250 Builtins::kFunctionPrototypeCall, 1, false);
1251 SimpleInstallFunction(prototype, factory->toString_string(), 1251 SimpleInstallFunction(prototype, factory->toString_string(),
1252 Builtins::kFunctionPrototypeToString, 0, false); 1252 Builtins::kFunctionPrototypeToString, 0, false);
1253 1253
1254 // Install the @@hasInstance function. 1254 // Install the @@hasInstance function.
1255 Handle<JSFunction> has_instance = InstallFunction( 1255 Handle<JSFunction> has_instance = InstallFunction(
1256 prototype, factory->has_instance_symbol(), JS_OBJECT_TYPE, 1256 prototype, factory->has_instance_symbol(), JS_OBJECT_TYPE,
1257 JSObject::kHeaderSize, MaybeHandle<JSObject>(), 1257 JSObject::kHeaderSize, MaybeHandle<JSObject>(),
1258 Builtins::kFunctionPrototypeHasInstance, 1258 Builtins::kFunctionPrototypeHasInstance,
1259 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)); 1259 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY));
1260 has_instance->shared()->set_builtin_function_id(kFunctionHasInstance);
1260 native_context()->set_function_has_instance(*has_instance); 1261 native_context()->set_function_has_instance(*has_instance);
1261 1262
1262 // Set the expected parameters for @@hasInstance to 1; required by builtin. 1263 // Set the expected parameters for @@hasInstance to 1; required by builtin.
1263 has_instance->shared()->set_internal_formal_parameter_count(1); 1264 has_instance->shared()->set_internal_formal_parameter_count(1);
1264 1265
1265 // Set the length for the function to satisfy ECMA-262. 1266 // Set the length for the function to satisfy ECMA-262.
1266 has_instance->shared()->set_length(1); 1267 has_instance->shared()->set_length(1);
1267 1268
1268 // Install the "constructor" property on the %FunctionPrototype%. 1269 // Install the "constructor" property on the %FunctionPrototype%.
1269 JSObject::AddProperty(prototype, factory->constructor_string(), 1270 JSObject::AddProperty(prototype, factory->constructor_string(),
(...skipping 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after
4566 } 4567 }
4567 4568
4568 4569
4569 // Called when the top-level V8 mutex is destroyed. 4570 // Called when the top-level V8 mutex is destroyed.
4570 void Bootstrapper::FreeThreadResources() { 4571 void Bootstrapper::FreeThreadResources() {
4571 DCHECK(!IsActive()); 4572 DCHECK(!IsActive());
4572 } 4573 }
4573 4574
4574 } // namespace internal 4575 } // namespace internal
4575 } // namespace v8 4576 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | src/compiler/js-native-context-specialization.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698