| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ic/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
| 8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
| 9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 297 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
| 298 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength); | 298 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength); |
| 299 } | 299 } |
| 300 | 300 |
| 301 | 301 |
| 302 static void StoreIC_PushArgs(MacroAssembler* masm) { | 302 static void StoreIC_PushArgs(MacroAssembler* masm) { |
| 303 Register receiver = StoreDescriptor::ReceiverRegister(); | 303 Register receiver = StoreDescriptor::ReceiverRegister(); |
| 304 Register name = StoreDescriptor::NameRegister(); | 304 Register name = StoreDescriptor::NameRegister(); |
| 305 Register value = StoreDescriptor::ValueRegister(); | 305 Register value = StoreDescriptor::ValueRegister(); |
| 306 | 306 |
| 307 DCHECK(!ebx.is(receiver) && !ebx.is(name) && !ebx.is(value)); | 307 if (FLAG_vector_stores) { |
| 308 Register slot = VectorStoreICDescriptor::SlotRegister(); |
| 309 Register vector = VectorStoreICDescriptor::VectorRegister(); |
| 308 | 310 |
| 309 __ pop(ebx); | 311 __ xchg(receiver, Operand(esp, 0)); |
| 310 __ push(receiver); | 312 __ push(name); |
| 311 __ push(name); | 313 __ push(value); |
| 312 __ push(value); | 314 __ push(slot); |
| 313 __ push(ebx); | 315 __ push(vector); |
| 316 __ push(receiver); // which contains the return address. |
| 317 } else { |
| 318 DCHECK(!ebx.is(receiver) && !ebx.is(name) && !ebx.is(value)); |
| 319 __ pop(ebx); |
| 320 __ push(receiver); |
| 321 __ push(name); |
| 322 __ push(value); |
| 323 __ push(ebx); |
| 324 } |
| 314 } | 325 } |
| 315 | 326 |
| 316 | 327 |
| 317 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 328 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
| 318 // Return address is on the stack. | 329 // Return address is on the stack. |
| 319 StoreIC_PushArgs(masm); | 330 StoreIC_PushArgs(masm); |
| 320 | 331 |
| 321 // Do tail-call to runtime routine. | 332 // Do tail-call to runtime routine. |
| 322 __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1); | 333 __ TailCallRuntime(Runtime::kStoreIC_Slow, FLAG_vector_stores ? 5 : 3, 1); |
| 323 } | 334 } |
| 324 | 335 |
| 325 | 336 |
| 326 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 337 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
| 327 // Return address is on the stack. | 338 // Return address is on the stack. |
| 328 StoreIC_PushArgs(masm); | 339 StoreIC_PushArgs(masm); |
| 329 | 340 |
| 330 // Do tail-call to runtime routine. | 341 // Do tail-call to runtime routine. |
| 331 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1); | 342 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, FLAG_vector_stores ? 5 : 3, |
| 343 1); |
| 332 } | 344 } |
| 333 | 345 |
| 334 | 346 |
| 335 #undef __ | 347 #undef __ |
| 336 #define __ ACCESS_MASM(masm()) | 348 #define __ ACCESS_MASM(masm()) |
| 337 | 349 |
| 338 | 350 |
| 339 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 351 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
| 340 Handle<Name> name) { | 352 Handle<Name> name) { |
| 341 if (!label->is_unused()) { | 353 if (!label->is_unused()) { |
| 342 __ bind(label); | 354 __ bind(label); |
| 343 __ mov(this->name(), Immediate(name)); | 355 __ mov(this->name(), Immediate(name)); |
| 344 } | 356 } |
| 345 } | 357 } |
| 346 | 358 |
| 347 | 359 |
| 348 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) { | 360 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) { |
| 349 __ mov(this->name(), Immediate(name)); | 361 __ mov(this->name(), Immediate(name)); |
| 350 } | 362 } |
| 351 | 363 |
| 352 | 364 |
| 353 void NamedStoreHandlerCompiler::GeneratePushMap(Register map_reg, | 365 void NamedStoreHandlerCompiler::GeneratePushMap(Register map_reg, |
| 354 Register scratch) { | 366 Register scratch) { |
| 355 // Get the return address, push the argument and then continue. | 367 // current after GeneratePushMap |
| 356 __ pop(scratch); | 368 // ------------------------------------------------- |
| 369 // ret addr slot |
| 370 // vector vector |
| 371 // sp -> slot map |
| 372 // sp -> ret addr |
| 373 // |
| 374 __ xchg(map_reg, Operand(esp, 0)); |
| 375 __ xchg(map_reg, Operand(esp, 2 * kPointerSize)); |
| 357 __ push(map_reg); | 376 __ push(map_reg); |
| 358 __ push(scratch); | |
| 359 } | 377 } |
| 360 | 378 |
| 361 | 379 |
| 362 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, | 380 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, |
| 363 Register map_reg, | 381 Register map_reg, |
| 364 Register scratch, | 382 Register scratch, |
| 365 Label* miss) { | 383 Label* miss) { |
| 366 Handle<WeakCell> cell = Map::WeakCellForMap(transition); | 384 Handle<WeakCell> cell = Map::WeakCellForMap(transition); |
| 367 DCHECK(!map_reg.is(scratch)); | 385 DCHECK(!map_reg.is(scratch)); |
| 368 __ LoadWeakValue(map_reg, cell, miss); | 386 __ LoadWeakValue(map_reg, cell, miss); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 __ bind(&success); | 586 __ bind(&success); |
| 569 } | 587 } |
| 570 } | 588 } |
| 571 | 589 |
| 572 | 590 |
| 573 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 591 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
| 574 if (!miss->is_unused()) { | 592 if (!miss->is_unused()) { |
| 575 Label success; | 593 Label success; |
| 576 __ jmp(&success); | 594 __ jmp(&success); |
| 577 GenerateRestoreName(miss, name); | 595 GenerateRestoreName(miss, name); |
| 596 if (IC::ICUseVector(kind())) PopVectorAndSlot(); |
| 578 TailCallBuiltin(masm(), MissBuiltin(kind())); | 597 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 579 __ bind(&success); | 598 __ bind(&success); |
| 580 } | 599 } |
| 581 } | 600 } |
| 582 | 601 |
| 583 | 602 |
| 584 void NamedLoadHandlerCompiler::GenerateLoadCallback( | 603 void NamedLoadHandlerCompiler::GenerateLoadCallback( |
| 585 Register reg, Handle<ExecutableAccessorInfo> callback) { | 604 Register reg, Handle<ExecutableAccessorInfo> callback) { |
| 586 // Insert additional parameters into the stack frame above return address. | 605 // Insert additional parameters into the stack frame above return address. |
| 587 DCHECK(!scratch3().is(reg)); | 606 DCHECK(!scratch3().is(reg)); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 // Return the generated code. | 823 // Return the generated code. |
| 805 return GetCode(kind(), Code::NORMAL, name); | 824 return GetCode(kind(), Code::NORMAL, name); |
| 806 } | 825 } |
| 807 | 826 |
| 808 | 827 |
| 809 #undef __ | 828 #undef __ |
| 810 } // namespace internal | 829 } // namespace internal |
| 811 } // namespace v8 | 830 } // namespace v8 |
| 812 | 831 |
| 813 #endif // V8_TARGET_ARCH_IA32 | 832 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |