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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 // Objects with a non-function constructor have class 'Object'. | 2733 // Objects with a non-function constructor have class 'Object'. |
2734 __ bind(&non_function_constructor); | 2734 __ bind(&non_function_constructor); |
2735 __ mov(eax, isolate()->factory()->Object_string()); | 2735 __ mov(eax, isolate()->factory()->Object_string()); |
2736 | 2736 |
2737 // All done. | 2737 // All done. |
2738 __ bind(&done); | 2738 __ bind(&done); |
2739 | 2739 |
2740 context()->Plug(eax); | 2740 context()->Plug(eax); |
2741 } | 2741 } |
2742 | 2742 |
| 2743 |
| 2744 void FullCodeGenerator::EmitValueOf(CallRuntime* expr) { |
| 2745 ZoneList<Expression*>* args = expr->arguments(); |
| 2746 DCHECK(args->length() == 1); |
| 2747 |
| 2748 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 2749 |
| 2750 Label done; |
| 2751 // If the object is a smi return the object. |
| 2752 __ JumpIfSmi(eax, &done, Label::kNear); |
| 2753 // If the object is not a value type, return the object. |
| 2754 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); |
| 2755 __ j(not_equal, &done, Label::kNear); |
| 2756 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); |
| 2757 |
| 2758 __ bind(&done); |
| 2759 context()->Plug(eax); |
| 2760 } |
| 2761 |
2743 | 2762 |
2744 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 2763 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
2745 ZoneList<Expression*>* args = expr->arguments(); | 2764 ZoneList<Expression*>* args = expr->arguments(); |
2746 DCHECK(args->length() == 1); | 2765 DCHECK(args->length() == 1); |
2747 | 2766 |
2748 VisitForAccumulatorValue(args->at(0)); | 2767 VisitForAccumulatorValue(args->at(0)); |
2749 | 2768 |
2750 Label done; | 2769 Label done; |
2751 StringCharFromCodeGenerator generator(eax, ebx); | 2770 StringCharFromCodeGenerator generator(eax, ebx); |
2752 generator.GenerateFast(masm_); | 2771 generator.GenerateFast(masm_); |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3668 isolate->builtins()->OnStackReplacement()->entry(), | 3687 isolate->builtins()->OnStackReplacement()->entry(), |
3669 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3688 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3670 return ON_STACK_REPLACEMENT; | 3689 return ON_STACK_REPLACEMENT; |
3671 } | 3690 } |
3672 | 3691 |
3673 | 3692 |
3674 } // namespace internal | 3693 } // namespace internal |
3675 } // namespace v8 | 3694 } // namespace v8 |
3676 | 3695 |
3677 #endif // V8_TARGET_ARCH_IA32 | 3696 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |