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

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

Issue 2571883002: [stubs] Add CSA::IsSymbol() and CSA::IsPrivateSymbol(). (Closed)
Patch Set: remove stuff 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | 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 17862fac45519286bcb2d30c51addb69ed3bcd6d..da4cc9d24f4d72db429387c6376fcc8dc666a956 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -2915,6 +2915,26 @@ Node* CodeStubAssembler::IsString(Node* object) {
Int32Constant(FIRST_NONSTRING_TYPE));
}
+Node* CodeStubAssembler::IsSymbol(Node* object) {
+ return HasInstanceType(object, SYMBOL_TYPE);
Igor Sheludko 2016/12/13 20:56:28 IsSymbolMap(LoadMap(object)) does not require load
gsathya 2016/12/13 22:01:03 Doh ofc. Changed
+}
+
+Node* CodeStubAssembler::IsPrivateSymbol(Node* object) {
+ Label out(this);
+ Variable var_result(this, MachineType::PointerRepresentation());
Igor Sheludko 2016/12/13 20:56:28 CSA expects kWord32 nodes as a condition in Branch
gsathya 2016/12/13 22:01:04 Ah, okay. Changed.
+ var_result.Bind(IntPtrConstant(0));
Igor Sheludko 2016/12/13 20:56:28 Same here: Int32Constant().
gsathya 2016/12/13 22:01:03 Done.
+
+ GotoUnless(IsSymbolMap(LoadMap(object)), &out);
Igor Sheludko 2016/12/13 20:56:28 IsSymbol(object)
gsathya 2016/12/13 22:01:04 Done.
+ Node* const flags =
+ SmiToWord32(LoadObjectField(object, Symbol::kFlagsOffset));
+ const int kPrivateMask = 1 << Symbol::kPrivateBit;
+ var_result.Bind(IsSetWord32(flags, kPrivateMask));
+ Goto(&out);
+
+ Bind(&out);
+ return var_result.value();
Igor Sheludko 2016/12/13 20:56:28 You may want to use Select() for this.
gsathya 2016/12/13 22:01:03 I did initially but didn't look very readable to m
+}
+
Node* CodeStubAssembler::IsNativeContext(Node* object) {
return WordEqual(LoadMap(object), LoadRoot(Heap::kNativeContextMapRootIndex));
}
@@ -4271,10 +4291,9 @@ void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex,
Goto(if_keyisindex);
Bind(&if_keyisnotindex);
- Node* key_instance_type = LoadInstanceType(key);
// Symbols are unique.
- GotoIf(Word32Equal(key_instance_type, Int32Constant(SYMBOL_TYPE)),
- if_keyisunique);
+ GotoIf(IsSymbol(key), if_keyisunique);
+ Node* key_instance_type = LoadInstanceType(key);
Igor Sheludko 2016/12/13 20:56:28 On this path we are loading map twice. How about:
gsathya 2016/12/13 22:01:04 Done.
// Miss if |key| is not a String.
STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE);
GotoUnless(IsStringInstanceType(key_instance_type), if_bailout);
« no previous file with comments | « src/code-stub-assembler.h ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698