Chromium Code Reviews| Index: src/code-stub-assembler.cc |
| diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc |
| index 7ec5a88e5610048c7d9f54a990c39a50ea4b92a6..fe0123ef00ac35832611291cabd1968dbc79b155 100644 |
| --- a/src/code-stub-assembler.cc |
| +++ b/src/code-stub-assembler.cc |
| @@ -2216,6 +2216,54 @@ Node* CodeStubAssembler::StringFromCharCode(Node* code) { |
| return var_result.value(); |
| } |
| +Node* CodeStubAssembler::ToName(Node* context, Node* value) { |
| + typedef CodeStubAssembler::Label Label; |
| + typedef CodeStubAssembler::Variable Variable; |
| + |
| + Label end(this); |
| + Variable var_result(this, MachineRepresentation::kTagged); |
| + |
| + Label is_number(this, Label::kDeferred); |
|
Igor Sheludko
2016/09/06 08:23:04
I would suggest not to use deferred labels when re
|
| + GotoIf(WordIsSmi(value), &is_number); |
| + |
| + Label not_name(this, Label::kDeferred); |
|
Igor Sheludko
2016/09/06 08:23:04
Same here.
|
| + Node* value_instance_type = LoadInstanceType(value); |
|
Igor Sheludko
2016/09/06 08:23:04
Please add
STATIC_ASSERT(FIRST_NAME_TYPE == FIRS
|
| + GotoIf(Int32GreaterThan(value_instance_type, Int32Constant(LAST_NAME_TYPE)), |
| + ¬_name); |
| + |
| + var_result.Bind(value); |
| + Goto(&end); |
| + |
| + Bind(&is_number); |
| + { |
| + Callable callable = CodeFactory::NumberToString(isolate()); |
| + var_result.Bind(CallStub(callable, context, value)); |
| + Goto(&end); |
| + } |
| + |
| + Bind(¬_name); |
| + { |
| + GotoIf(Word32Equal(value_instance_type, Int32Constant(HEAP_NUMBER_TYPE)), |
| + &is_number); |
| + |
| + Label not_oddball(this, Label::kDeferred); |
|
Igor Sheludko
2016/09/06 08:23:04
Same here.
|
| + GotoIf(Word32NotEqual(value_instance_type, Int32Constant(ODDBALL_TYPE)), |
| + ¬_oddball); |
| + |
| + var_result.Bind(LoadObjectField(value, Oddball::kToStringOffset)); |
| + Goto(&end); |
| + |
| + Bind(¬_oddball); |
| + { |
| + var_result.Bind(CallRuntime(Runtime::kToName, context, value)); |
| + Goto(&end); |
| + } |
| + } |
| + |
| + Bind(&end); |
| + return var_result.value(); |
| +} |
| + |
| Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
| uint32_t mask) { |
| return Word32Shr(Word32And(word32, Int32Constant(mask)), |