| 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/crankshaft/x87/lithium-codegen-x87.h" | 7 #include "src/crankshaft/x87/lithium-codegen-x87.h" |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3010 | 3010 |
| 3011 | 3011 |
| 3012 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { | 3012 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { |
| 3013 Register receiver = ToRegister(instr->receiver()); | 3013 Register receiver = ToRegister(instr->receiver()); |
| 3014 Register function = ToRegister(instr->function()); | 3014 Register function = ToRegister(instr->function()); |
| 3015 | 3015 |
| 3016 // If the receiver is null or undefined, we have to pass the global | 3016 // If the receiver is null or undefined, we have to pass the global |
| 3017 // object as a receiver to normal functions. Values have to be | 3017 // object as a receiver to normal functions. Values have to be |
| 3018 // passed unchanged to builtins and strict-mode functions. | 3018 // passed unchanged to builtins and strict-mode functions. |
| 3019 Label receiver_ok, global_object; | 3019 Label receiver_ok, global_object; |
| 3020 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; | 3020 Label::Distance dist; |
| 3021 |
| 3022 // For x87 debug version jitted code's size exceeds 128 bytes whether |
| 3023 // FLAG_deopt_every_n_times |
| 3024 // is set or not. Always use Label:kFar for label distance for debug mode. |
| 3025 if (FLAG_debug_code) |
| 3026 dist = Label::kFar; |
| 3027 else |
| 3028 dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
| 3029 |
| 3021 Register scratch = ToRegister(instr->temp()); | 3030 Register scratch = ToRegister(instr->temp()); |
| 3022 | 3031 |
| 3023 if (!instr->hydrogen()->known_function()) { | 3032 if (!instr->hydrogen()->known_function()) { |
| 3024 // Do not transform the receiver to object for strict mode | 3033 // Do not transform the receiver to object for strict mode |
| 3025 // functions. | 3034 // functions. |
| 3026 __ mov(scratch, | 3035 __ mov(scratch, |
| 3027 FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); | 3036 FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 3028 __ test_b(FieldOperand(scratch, SharedFunctionInfo::kStrictModeByteOffset), | 3037 __ test_b(FieldOperand(scratch, SharedFunctionInfo::kStrictModeByteOffset), |
| 3029 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); | 3038 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); |
| 3030 __ j(not_equal, &receiver_ok, dist); | 3039 __ j(not_equal, &receiver_ok, dist); |
| 3031 | 3040 |
| 3032 // Do not transform the receiver to object for builtins. | 3041 // Do not transform the receiver to object for builtins. |
| 3033 __ test_b(FieldOperand(scratch, SharedFunctionInfo::kNativeByteOffset), | 3042 __ test_b(FieldOperand(scratch, SharedFunctionInfo::kNativeByteOffset), |
| 3034 Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte)); | 3043 Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte)); |
| 3035 __ j(not_equal, &receiver_ok, dist); | 3044 __ j(not_equal, &receiver_ok, dist); |
| 3036 } | 3045 } |
| 3037 | 3046 |
| 3038 // Normal function. Replace undefined or null with global receiver. | 3047 // Normal function. Replace undefined or null with global receiver. |
| 3039 __ cmp(receiver, factory()->null_value()); | 3048 __ cmp(receiver, factory()->null_value()); |
| 3040 __ j(equal, &global_object, Label::kNear); | 3049 __ j(equal, &global_object, dist); |
| 3041 __ cmp(receiver, factory()->undefined_value()); | 3050 __ cmp(receiver, factory()->undefined_value()); |
| 3042 __ j(equal, &global_object, Label::kNear); | 3051 __ j(equal, &global_object, dist); |
| 3043 | 3052 |
| 3044 // The receiver should be a JS object. | 3053 // The receiver should be a JS object. |
| 3045 __ test(receiver, Immediate(kSmiTagMask)); | 3054 __ test(receiver, Immediate(kSmiTagMask)); |
| 3046 DeoptimizeIf(equal, instr, DeoptimizeReason::kSmi); | 3055 DeoptimizeIf(equal, instr, DeoptimizeReason::kSmi); |
| 3047 __ CmpObjectType(receiver, FIRST_JS_RECEIVER_TYPE, scratch); | 3056 __ CmpObjectType(receiver, FIRST_JS_RECEIVER_TYPE, scratch); |
| 3048 DeoptimizeIf(below, instr, DeoptimizeReason::kNotAJavaScriptObject); | 3057 DeoptimizeIf(below, instr, DeoptimizeReason::kNotAJavaScriptObject); |
| 3049 | 3058 |
| 3050 __ jmp(&receiver_ok, Label::kNear); | 3059 __ jmp(&receiver_ok, dist); |
| 3051 __ bind(&global_object); | 3060 __ bind(&global_object); |
| 3052 __ mov(receiver, FieldOperand(function, JSFunction::kContextOffset)); | 3061 __ mov(receiver, FieldOperand(function, JSFunction::kContextOffset)); |
| 3053 __ mov(receiver, ContextOperand(receiver, Context::NATIVE_CONTEXT_INDEX)); | 3062 __ mov(receiver, ContextOperand(receiver, Context::NATIVE_CONTEXT_INDEX)); |
| 3054 __ mov(receiver, ContextOperand(receiver, Context::GLOBAL_PROXY_INDEX)); | 3063 __ mov(receiver, ContextOperand(receiver, Context::GLOBAL_PROXY_INDEX)); |
| 3055 __ bind(&receiver_ok); | 3064 __ bind(&receiver_ok); |
| 3056 } | 3065 } |
| 3057 | 3066 |
| 3058 | 3067 |
| 3059 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 3068 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
| 3060 Register receiver = ToRegister(instr->receiver()); | 3069 Register receiver = ToRegister(instr->receiver()); |
| (...skipping 2578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5639 __ bind(deferred->exit()); | 5648 __ bind(deferred->exit()); |
| 5640 __ bind(&done); | 5649 __ bind(&done); |
| 5641 } | 5650 } |
| 5642 | 5651 |
| 5643 #undef __ | 5652 #undef __ |
| 5644 | 5653 |
| 5645 } // namespace internal | 5654 } // namespace internal |
| 5646 } // namespace v8 | 5655 } // namespace v8 |
| 5647 | 5656 |
| 5648 #endif // V8_TARGET_ARCH_X87 | 5657 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |