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

Unified Diff: src/code-stub-assembler.cc

Issue 2435283002: [stubs] Add IsCallableMap predicate to CSA (Closed)
Patch Set: Remove unused variable Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index 432613d929fae795fe962ae38ade473cb59d0593..e7df20d9cc2edbcd4ea785eb766729b87a967256 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -2569,6 +2569,12 @@ Node* CodeStubAssembler::IsJSReceiverInstanceType(Node* instance_type) {
Int32Constant(FIRST_JS_RECEIVER_TYPE));
}
+Node* CodeStubAssembler::IsCallableMap(Node* map) {
+ return Word32NotEqual(
+ Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsCallable)),
+ Int32Constant(0));
+}
+
Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index) {
// Translate the {index} into a Word.
index = SmiToWord(index);
@@ -4295,10 +4301,7 @@ Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details,
// Return undefined if the {getter} is not callable.
var_value.Bind(UndefinedConstant());
- GotoIf(Word32Equal(Word32And(LoadMapBitField(getter_map),
- Int32Constant(1 << Map::kIsCallable)),
- Int32Constant(0)),
- &done);
+ GotoUnless(IsCallableMap(getter_map), &done);
// Call the accessor.
Callable callable = CodeFactory::Call(isolate());
@@ -8096,10 +8099,7 @@ compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object,
// Check if {callable} is a valid receiver.
GotoIf(TaggedIsSmi(callable), &return_runtime);
- GotoIf(Word32Equal(Word32And(LoadMapBitField(LoadMap(callable)),
- Int32Constant(1 << Map::kIsCallable)),
- Int32Constant(0)),
- &return_runtime);
+ GotoUnless(IsCallableMap(LoadMap(callable)), &return_runtime);
// Use the inline OrdinaryHasInstance directly.
result.Bind(OrdinaryHasInstance(context, callable, object));
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698