| 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/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
| 8 | 8 |
| 9 #include "src/field-type.h" | 9 #include "src/field-type.h" |
| 10 #include "src/ic/call-optimization.h" | 10 #include "src/ic/call-optimization.h" |
| 11 #include "src/ic/ic.h" | 11 #include "src/ic/ic.h" |
| 12 #include "src/isolate-inl.h" | 12 #include "src/isolate-inl.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 #define __ ACCESS_MASM(masm) | 17 #define __ ACCESS_MASM(masm) |
| 18 | 18 |
| 19 | 19 |
| 20 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( | 20 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
| 21 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, | 21 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, |
| 22 int accessor_index, int expected_arguments, Register scratch) { | 22 int accessor_index, int expected_arguments, Register scratch) { |
| 23 { | 23 { |
| 24 FrameScope scope(masm, StackFrame::INTERNAL); | 24 FrameScope scope(masm, StackFrame::INTERNAL); |
| 25 | 25 |
| 26 // Save context register |
| 27 __ push(esi); |
| 28 |
| 26 if (accessor_index >= 0) { | 29 if (accessor_index >= 0) { |
| 27 DCHECK(!holder.is(scratch)); | 30 DCHECK(!holder.is(scratch)); |
| 28 DCHECK(!receiver.is(scratch)); | 31 DCHECK(!receiver.is(scratch)); |
| 29 // Call the JavaScript getter with the receiver on the stack. | 32 // Call the JavaScript getter with the receiver on the stack. |
| 30 if (map->IsJSGlobalObjectMap()) { | 33 if (map->IsJSGlobalObjectMap()) { |
| 31 // Swap in the global receiver. | 34 // Swap in the global receiver. |
| 32 __ mov(scratch, | 35 __ mov(scratch, |
| 33 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 36 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 34 receiver = scratch; | 37 receiver = scratch; |
| 35 } | 38 } |
| 36 __ push(receiver); | 39 __ push(receiver); |
| 37 ParameterCount actual(0); | 40 ParameterCount actual(0); |
| 38 ParameterCount expected(expected_arguments); | 41 ParameterCount expected(expected_arguments); |
| 39 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_GETTER); | 42 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_GETTER); |
| 40 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, | 43 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, |
| 41 CheckDebugStepCallWrapper()); | 44 CheckDebugStepCallWrapper()); |
| 42 } else { | 45 } else { |
| 43 // If we generate a global code snippet for deoptimization only, remember | 46 // If we generate a global code snippet for deoptimization only, remember |
| 44 // the place to continue after deoptimization. | 47 // the place to continue after deoptimization. |
| 45 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 48 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
| 46 } | 49 } |
| 47 | 50 |
| 48 // Restore context register. | 51 // Restore context register. |
| 49 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 52 __ pop(esi); |
| 50 } | 53 } |
| 51 __ ret(0); | 54 __ ret(0); |
| 52 } | 55 } |
| 53 | 56 |
| 54 | 57 |
| 55 void PropertyHandlerCompiler::PushVectorAndSlot(Register vector, | 58 void PropertyHandlerCompiler::PushVectorAndSlot(Register vector, |
| 56 Register slot) { | 59 Register slot) { |
| 57 MacroAssembler* masm = this->masm(); | 60 MacroAssembler* masm = this->masm(); |
| 58 __ push(vector); | 61 __ push(vector); |
| 59 __ push(slot); | 62 __ push(slot); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 248 |
| 246 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 249 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
| 247 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, | 250 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, |
| 248 int accessor_index, int expected_arguments, Register scratch) { | 251 int accessor_index, int expected_arguments, Register scratch) { |
| 249 // ----------- S t a t e ------------- | 252 // ----------- S t a t e ------------- |
| 250 // -- esp[0] : return address | 253 // -- esp[0] : return address |
| 251 // ----------------------------------- | 254 // ----------------------------------- |
| 252 { | 255 { |
| 253 FrameScope scope(masm, StackFrame::INTERNAL); | 256 FrameScope scope(masm, StackFrame::INTERNAL); |
| 254 | 257 |
| 258 // Save context register |
| 259 __ push(esi); |
| 255 // Save value register, so we can restore it later. | 260 // Save value register, so we can restore it later. |
| 256 __ push(value()); | 261 __ push(value()); |
| 257 | 262 |
| 258 if (accessor_index >= 0) { | 263 if (accessor_index >= 0) { |
| 259 DCHECK(!holder.is(scratch)); | 264 DCHECK(!holder.is(scratch)); |
| 260 DCHECK(!receiver.is(scratch)); | 265 DCHECK(!receiver.is(scratch)); |
| 261 DCHECK(!value().is(scratch)); | 266 DCHECK(!value().is(scratch)); |
| 262 // Call the JavaScript setter with receiver and value on the stack. | 267 // Call the JavaScript setter with receiver and value on the stack. |
| 263 if (map->IsJSGlobalObjectMap()) { | 268 if (map->IsJSGlobalObjectMap()) { |
| 264 __ mov(scratch, | 269 __ mov(scratch, |
| 265 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 270 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 266 receiver = scratch; | 271 receiver = scratch; |
| 267 } | 272 } |
| 268 __ push(receiver); | 273 __ push(receiver); |
| 269 __ push(value()); | 274 __ push(value()); |
| 270 ParameterCount actual(1); | 275 ParameterCount actual(1); |
| 271 ParameterCount expected(expected_arguments); | 276 ParameterCount expected(expected_arguments); |
| 272 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER); | 277 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER); |
| 273 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, | 278 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, |
| 274 CheckDebugStepCallWrapper()); | 279 CheckDebugStepCallWrapper()); |
| 275 } else { | 280 } else { |
| 276 // If we generate a global code snippet for deoptimization only, remember | 281 // If we generate a global code snippet for deoptimization only, remember |
| 277 // the place to continue after deoptimization. | 282 // the place to continue after deoptimization. |
| 278 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 283 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
| 279 } | 284 } |
| 280 | 285 |
| 281 // We have to return the passed value, not the return value of the setter. | 286 // We have to return the passed value, not the return value of the setter. |
| 282 __ pop(eax); | 287 __ pop(eax); |
| 283 | |
| 284 // Restore context register. | 288 // Restore context register. |
| 285 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 289 __ pop(esi); |
| 286 } | 290 } |
| 287 __ ret(0); | 291 __ ret(0); |
| 288 } | 292 } |
| 289 | 293 |
| 290 | 294 |
| 291 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, | 295 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, |
| 292 Register holder, Register name, | 296 Register holder, Register name, |
| 293 Handle<JSObject> holder_obj) { | 297 Handle<JSObject> holder_obj) { |
| 294 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); | 298 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); |
| 295 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); | 299 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 // Return the generated code. | 818 // Return the generated code. |
| 815 return GetCode(kind(), Code::NORMAL, name); | 819 return GetCode(kind(), Code::NORMAL, name); |
| 816 } | 820 } |
| 817 | 821 |
| 818 | 822 |
| 819 #undef __ | 823 #undef __ |
| 820 } // namespace internal | 824 } // namespace internal |
| 821 } // namespace v8 | 825 } // namespace v8 |
| 822 | 826 |
| 823 #endif // V8_TARGET_ARCH_X87 | 827 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |