OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 // Objects with a non-function constructor have class 'Object'. | 2726 // Objects with a non-function constructor have class 'Object'. |
2727 __ bind(&non_function_constructor); | 2727 __ bind(&non_function_constructor); |
2728 __ LoadRoot(rax, Heap::kObject_stringRootIndex); | 2728 __ LoadRoot(rax, Heap::kObject_stringRootIndex); |
2729 | 2729 |
2730 // All done. | 2730 // All done. |
2731 __ bind(&done); | 2731 __ bind(&done); |
2732 | 2732 |
2733 context()->Plug(rax); | 2733 context()->Plug(rax); |
2734 } | 2734 } |
2735 | 2735 |
| 2736 |
| 2737 void FullCodeGenerator::EmitValueOf(CallRuntime* expr) { |
| 2738 ZoneList<Expression*>* args = expr->arguments(); |
| 2739 DCHECK(args->length() == 1); |
| 2740 |
| 2741 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 2742 |
| 2743 Label done; |
| 2744 // If the object is a smi return the object. |
| 2745 __ JumpIfSmi(rax, &done); |
| 2746 // If the object is not a value type, return the object. |
| 2747 __ CmpObjectType(rax, JS_VALUE_TYPE, rbx); |
| 2748 __ j(not_equal, &done); |
| 2749 __ movp(rax, FieldOperand(rax, JSValue::kValueOffset)); |
| 2750 |
| 2751 __ bind(&done); |
| 2752 context()->Plug(rax); |
| 2753 } |
| 2754 |
2736 | 2755 |
2737 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 2756 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
2738 ZoneList<Expression*>* args = expr->arguments(); | 2757 ZoneList<Expression*>* args = expr->arguments(); |
2739 DCHECK(args->length() == 1); | 2758 DCHECK(args->length() == 1); |
2740 | 2759 |
2741 VisitForAccumulatorValue(args->at(0)); | 2760 VisitForAccumulatorValue(args->at(0)); |
2742 | 2761 |
2743 Label done; | 2762 Label done; |
2744 StringCharFromCodeGenerator generator(rax, rbx); | 2763 StringCharFromCodeGenerator generator(rax, rbx); |
2745 generator.GenerateFast(masm_); | 2764 generator.GenerateFast(masm_); |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3658 DCHECK_EQ( | 3677 DCHECK_EQ( |
3659 isolate->builtins()->OnStackReplacement()->entry(), | 3678 isolate->builtins()->OnStackReplacement()->entry(), |
3660 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3679 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3661 return ON_STACK_REPLACEMENT; | 3680 return ON_STACK_REPLACEMENT; |
3662 } | 3681 } |
3663 | 3682 |
3664 } // namespace internal | 3683 } // namespace internal |
3665 } // namespace v8 | 3684 } // namespace v8 |
3666 | 3685 |
3667 #endif // V8_TARGET_ARCH_X64 | 3686 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |