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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 // Objects with a non-function constructor have class 'Object'. | 2725 // Objects with a non-function constructor have class 'Object'. |
2726 __ bind(&non_function_constructor); | 2726 __ bind(&non_function_constructor); |
2727 __ mov(eax, isolate()->factory()->Object_string()); | 2727 __ mov(eax, isolate()->factory()->Object_string()); |
2728 | 2728 |
2729 // All done. | 2729 // All done. |
2730 __ bind(&done); | 2730 __ bind(&done); |
2731 | 2731 |
2732 context()->Plug(eax); | 2732 context()->Plug(eax); |
2733 } | 2733 } |
2734 | 2734 |
| 2735 |
| 2736 void FullCodeGenerator::EmitValueOf(CallRuntime* expr) { |
| 2737 ZoneList<Expression*>* args = expr->arguments(); |
| 2738 DCHECK(args->length() == 1); |
| 2739 |
| 2740 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 2741 |
| 2742 Label done; |
| 2743 // If the object is a smi return the object. |
| 2744 __ JumpIfSmi(eax, &done, Label::kNear); |
| 2745 // If the object is not a value type, return the object. |
| 2746 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); |
| 2747 __ j(not_equal, &done, Label::kNear); |
| 2748 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); |
| 2749 |
| 2750 __ bind(&done); |
| 2751 context()->Plug(eax); |
| 2752 } |
| 2753 |
2735 | 2754 |
2736 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 2755 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
2737 ZoneList<Expression*>* args = expr->arguments(); | 2756 ZoneList<Expression*>* args = expr->arguments(); |
2738 DCHECK(args->length() == 1); | 2757 DCHECK(args->length() == 1); |
2739 | 2758 |
2740 VisitForAccumulatorValue(args->at(0)); | 2759 VisitForAccumulatorValue(args->at(0)); |
2741 | 2760 |
2742 Label done; | 2761 Label done; |
2743 StringCharFromCodeGenerator generator(eax, ebx); | 2762 StringCharFromCodeGenerator generator(eax, ebx); |
2744 generator.GenerateFast(masm_); | 2763 generator.GenerateFast(masm_); |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3660 isolate->builtins()->OnStackReplacement()->entry(), | 3679 isolate->builtins()->OnStackReplacement()->entry(), |
3661 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3680 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3662 return ON_STACK_REPLACEMENT; | 3681 return ON_STACK_REPLACEMENT; |
3663 } | 3682 } |
3664 | 3683 |
3665 | 3684 |
3666 } // namespace internal | 3685 } // namespace internal |
3667 } // namespace v8 | 3686 } // namespace v8 |
3668 | 3687 |
3669 #endif // V8_TARGET_ARCH_X87 | 3688 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |