| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if defined(V8_TARGET_ARCH_ARM) |
| 31 |
| 30 #include "codegen-inl.h" | 32 #include "codegen-inl.h" |
| 31 #include "register-allocator-inl.h" | 33 #include "register-allocator-inl.h" |
| 32 #include "scopes.h" | 34 #include "scopes.h" |
| 33 #include "virtual-frame-inl.h" | 35 #include "virtual-frame-inl.h" |
| 34 | 36 |
| 35 namespace v8 { | 37 namespace v8 { |
| 36 namespace internal { | 38 namespace internal { |
| 37 | 39 |
| 38 #define __ ACCESS_MASM(masm()) | 40 #define __ ACCESS_MASM(masm()) |
| 39 | 41 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, | 302 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, |
| 301 InvokeJSFlags flags, | 303 InvokeJSFlags flags, |
| 302 int arg_count) { | 304 int arg_count) { |
| 303 Forget(arg_count); | 305 Forget(arg_count); |
| 304 __ InvokeBuiltin(id, flags); | 306 __ InvokeBuiltin(id, flags); |
| 305 } | 307 } |
| 306 | 308 |
| 307 | 309 |
| 308 void VirtualFrame::CallLoadIC(Handle<String> name, RelocInfo::Mode mode) { | 310 void VirtualFrame::CallLoadIC(Handle<String> name, RelocInfo::Mode mode) { |
| 309 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 311 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 310 SpillAllButCopyTOSToR0(); | 312 PopToR0(); |
| 313 SpillAll(); |
| 311 __ mov(r2, Operand(name)); | 314 __ mov(r2, Operand(name)); |
| 312 CallCodeObject(ic, mode, 0); | 315 CallCodeObject(ic, mode, 0); |
| 313 } | 316 } |
| 314 | 317 |
| 315 | 318 |
| 316 void VirtualFrame::CallStoreIC(Handle<String> name, bool is_contextual) { | 319 void VirtualFrame::CallStoreIC(Handle<String> name, bool is_contextual) { |
| 317 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 320 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); |
| 318 PopToR0(); | 321 PopToR0(); |
| 319 if (is_contextual) { | 322 if (is_contextual) { |
| 320 SpillAll(); | 323 SpillAll(); |
| 321 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 324 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 322 } else { | 325 } else { |
| 323 EmitPop(r1); | 326 EmitPop(r1); |
| 324 SpillAll(); | 327 SpillAll(); |
| 325 } | 328 } |
| 326 __ mov(r2, Operand(name)); | 329 __ mov(r2, Operand(name)); |
| 327 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); | 330 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); |
| 328 } | 331 } |
| 329 | 332 |
| 330 | 333 |
| 331 void VirtualFrame::CallKeyedLoadIC() { | 334 void VirtualFrame::CallKeyedLoadIC() { |
| 332 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 335 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 333 PopToR1R0(); | 336 PopToR1R0(); |
| 334 SpillAll(); | 337 SpillAll(); |
| 335 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); | 338 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); |
| 336 } | 339 } |
| 337 | 340 |
| 338 | 341 |
| 339 void VirtualFrame::CallKeyedStoreIC() { | 342 void VirtualFrame::CallKeyedStoreIC() { |
| 340 ASSERT(SpilledScope::is_spilled()); | |
| 341 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 343 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |
| 344 PopToR1R0(); |
| 345 SpillAll(); |
| 346 EmitPop(r2); |
| 342 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); | 347 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); |
| 343 } | 348 } |
| 344 | 349 |
| 345 | 350 |
| 346 void VirtualFrame::CallCodeObject(Handle<Code> code, | 351 void VirtualFrame::CallCodeObject(Handle<Code> code, |
| 347 RelocInfo::Mode rmode, | 352 RelocInfo::Mode rmode, |
| 348 int dropped_args) { | 353 int dropped_args) { |
| 349 switch (code->kind()) { | 354 switch (code->kind()) { |
| 350 case Code::CALL_IC: | 355 case Code::CALL_IC: |
| 351 case Code::FUNCTION: | 356 case Code::FUNCTION: |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 Register answer = kTopRegister[top_of_stack_state_]; | 503 Register answer = kTopRegister[top_of_stack_state_]; |
| 499 __ pop(answer); | 504 __ pop(answer); |
| 500 return answer; | 505 return answer; |
| 501 } else { | 506 } else { |
| 502 return kTopRegister[top_of_stack_state_]; | 507 return kTopRegister[top_of_stack_state_]; |
| 503 } | 508 } |
| 504 } | 509 } |
| 505 | 510 |
| 506 | 511 |
| 507 void VirtualFrame::Dup() { | 512 void VirtualFrame::Dup() { |
| 508 AssertIsNotSpilled(); | 513 if (SpilledScope::is_spilled()) { |
| 509 switch (top_of_stack_state_) { | 514 __ ldr(ip, MemOperand(sp, 0)); |
| 510 case NO_TOS_REGISTERS: | 515 __ push(ip); |
| 511 __ ldr(r0, MemOperand(sp, 0)); | 516 } else { |
| 512 top_of_stack_state_ = R0_TOS; | 517 switch (top_of_stack_state_) { |
| 513 break; | 518 case NO_TOS_REGISTERS: |
| 514 case R0_TOS: | 519 __ ldr(r0, MemOperand(sp, 0)); |
| 515 __ mov(r1, r0); | 520 top_of_stack_state_ = R0_TOS; |
| 516 // r0 and r1 contains the same value. Prefer a state with r0 holding TOS. | 521 break; |
| 517 top_of_stack_state_ = R0_R1_TOS; | 522 case R0_TOS: |
| 518 break; | 523 __ mov(r1, r0); |
| 519 case R1_TOS: | 524 // r0 and r1 contains the same value. Prefer state with r0 holding TOS. |
| 520 __ mov(r0, r1); | 525 top_of_stack_state_ = R0_R1_TOS; |
| 521 // r0 and r1 contains the same value. Prefer a state with r0 holding TOS. | 526 break; |
| 522 top_of_stack_state_ = R0_R1_TOS; | 527 case R1_TOS: |
| 523 break; | 528 __ mov(r0, r1); |
| 524 case R0_R1_TOS: | 529 // r0 and r1 contains the same value. Prefer state with r0 holding TOS. |
| 525 __ push(r1); | 530 top_of_stack_state_ = R0_R1_TOS; |
| 526 __ mov(r1, r0); | 531 break; |
| 527 // r0 and r1 contains the same value. Prefer a state with r0 holding TOS. | 532 case R0_R1_TOS: |
| 528 top_of_stack_state_ = R0_R1_TOS; | 533 __ push(r1); |
| 529 break; | 534 __ mov(r1, r0); |
| 530 case R1_R0_TOS: | 535 // r0 and r1 contains the same value. Prefer state with r0 holding TOS. |
| 531 __ push(r0); | 536 top_of_stack_state_ = R0_R1_TOS; |
| 532 __ mov(r0, r1); | 537 break; |
| 533 // r0 and r1 contains the same value. Prefer a state with r0 holding TOS. | 538 case R1_R0_TOS: |
| 534 top_of_stack_state_ = R0_R1_TOS; | 539 __ push(r0); |
| 535 break; | 540 __ mov(r0, r1); |
| 536 default: | 541 // r0 and r1 contains the same value. Prefer state with r0 holding TOS. |
| 537 UNREACHABLE(); | 542 top_of_stack_state_ = R0_R1_TOS; |
| 543 break; |
| 544 default: |
| 545 UNREACHABLE(); |
| 546 } |
| 538 } | 547 } |
| 539 element_count_++; | 548 element_count_++; |
| 540 } | 549 } |
| 541 | 550 |
| 542 | 551 |
| 543 void VirtualFrame::Dup2() { | 552 void VirtualFrame::Dup2() { |
| 544 if (SpilledScope::is_spilled()) { | 553 if (SpilledScope::is_spilled()) { |
| 545 __ ldr(ip, MemOperand(sp, kPointerSize)); | 554 __ ldr(ip, MemOperand(sp, kPointerSize)); |
| 546 __ push(ip); | 555 __ push(ip); |
| 547 __ ldr(ip, MemOperand(sp, kPointerSize)); | 556 __ ldr(ip, MemOperand(sp, kPointerSize)); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 default: | 751 default: |
| 743 UNREACHABLE(); | 752 UNREACHABLE(); |
| 744 break; | 753 break; |
| 745 } | 754 } |
| 746 ASSERT(register_allocation_map_ == 0); // Not yet implemented. | 755 ASSERT(register_allocation_map_ == 0); // Not yet implemented. |
| 747 } | 756 } |
| 748 | 757 |
| 749 #undef __ | 758 #undef __ |
| 750 | 759 |
| 751 } } // namespace v8::internal | 760 } } // namespace v8::internal |
| 761 |
| 762 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |