Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
| 9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
| 10 | 10 |
| (...skipping 3592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3603 | 3603 |
| 3604 Bind(¬_heap_number); | 3604 Bind(¬_heap_number); |
| 3605 { | 3605 { |
| 3606 GotoIf(Word32NotEqual(input_instance_type, Int32Constant(ODDBALL_TYPE)), | 3606 GotoIf(Word32NotEqual(input_instance_type, Int32Constant(ODDBALL_TYPE)), |
| 3607 &runtime); | 3607 &runtime); |
| 3608 result.Bind(LoadObjectField(input, Oddball::kToStringOffset)); | 3608 result.Bind(LoadObjectField(input, Oddball::kToStringOffset)); |
| 3609 Goto(&done); | 3609 Goto(&done); |
| 3610 } | 3610 } |
| 3611 | 3611 |
| 3612 Bind(&runtime); | 3612 Bind(&runtime); |
| 3613 { | 3613 result.Bind(CallRuntime(Runtime::kToString, context, input)); |
|
danno
2016/10/20 08:35:52
After our discussion, not sure if you want this wh
| |
| 3614 result.Bind(CallRuntime(Runtime::kToString, context, input)); | 3614 Goto(&done); |
| 3615 Goto(&done); | |
| 3616 } | |
| 3617 | 3615 |
| 3618 Bind(&done); | 3616 Bind(&done); |
| 3619 return result.value(); | 3617 return result.value(); |
| 3620 } | 3618 } |
| 3621 | 3619 |
| 3620 Node* CodeStubAssembler::FlattenString(Node* string) { | |
| 3621 Variable var_result(this, MachineRepresentation::kTagged); | |
| 3622 var_result.Bind(string); | |
| 3623 | |
| 3624 Node* instance_type = LoadInstanceType(string); | |
| 3625 | |
| 3626 // Check if the {string} is not a ConsString (i.e. already flat). | |
| 3627 Label is_flat_in_cons(this), end(this); | |
| 3628 GotoUnless(Word32Equal(Word32And(instance_type, | |
| 3629 Int32Constant(kStringRepresentationMask)), | |
| 3630 Int32Constant(kConsStringTag)), | |
| 3631 &end); | |
| 3632 | |
| 3633 // Check whether the right hand side is the empty string (i.e. if | |
| 3634 // this is really a flat string in a cons string). | |
| 3635 Node* rhs = LoadObjectField(string, ConsString::kSecondOffset); | |
| 3636 GotoIf(WordEqual(rhs, EmptyStringConstant()), &is_flat_in_cons); | |
| 3637 | |
| 3638 // Bail out to the runtime. | |
|
danno
2016/10/20 08:35:52
Make this label deferred. You can make that effici
| |
| 3639 var_result.Bind( | |
| 3640 CallRuntime(Runtime::kFlattenString, NoContextConstant(), string)); | |
| 3641 Goto(&end); | |
| 3642 | |
| 3643 Bind(&is_flat_in_cons); | |
| 3644 var_result.Bind(LoadObjectField(string, ConsString::kFirstOffset)); | |
| 3645 Goto(&end); | |
| 3646 | |
| 3647 Bind(&end); | |
| 3648 return var_result.value(); | |
| 3649 } | |
| 3650 | |
| 3622 Node* CodeStubAssembler::JSReceiverToPrimitive(Node* context, Node* input) { | 3651 Node* CodeStubAssembler::JSReceiverToPrimitive(Node* context, Node* input) { |
| 3623 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 3652 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 3624 Label if_isreceiver(this, Label::kDeferred), if_isnotreceiver(this); | 3653 Label if_isreceiver(this, Label::kDeferred), if_isnotreceiver(this); |
| 3625 Variable result(this, MachineRepresentation::kTagged); | 3654 Variable result(this, MachineRepresentation::kTagged); |
| 3626 Label done(this, &result); | 3655 Label done(this, &result); |
| 3627 | 3656 |
| 3628 GotoIf(TaggedIsSmi(input), &if_isnotreceiver); | 3657 GotoIf(TaggedIsSmi(input), &if_isnotreceiver); |
| 3629 | 3658 |
| 3630 Node* map = LoadMap(input); | 3659 Node* map = LoadMap(input); |
| 3631 Node* instance_type = LoadMapInstanceType(map); | 3660 Node* instance_type = LoadMapInstanceType(map); |
| (...skipping 4675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8307 Node* buffer_bit_field = LoadObjectField( | 8336 Node* buffer_bit_field = LoadObjectField( |
| 8308 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); | 8337 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); |
| 8309 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); | 8338 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); |
| 8310 | 8339 |
| 8311 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), | 8340 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), |
| 8312 Int32Constant(0)); | 8341 Int32Constant(0)); |
| 8313 } | 8342 } |
| 8314 | 8343 |
| 8315 } // namespace internal | 8344 } // namespace internal |
| 8316 } // namespace v8 | 8345 } // namespace v8 |
| OLD | NEW |