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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 ASSERT(argc >= 1 && generating_stub()); | 535 ASSERT(argc >= 1 && generating_stub()); |
536 ret((argc - 1) * kPointerSize); | 536 ret((argc - 1) * kPointerSize); |
537 } | 537 } |
538 | 538 |
539 | 539 |
540 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { | 540 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { |
541 return has_frame_ || !stub->SometimesSetsUpAFrame(); | 541 return has_frame_ || !stub->SometimesSetsUpAFrame(); |
542 } | 542 } |
543 | 543 |
544 | 544 |
545 void MacroAssembler::IllegalOperation(int num_arguments) { | |
546 if (num_arguments > 0) { | |
547 addp(rsp, Immediate(num_arguments * kPointerSize)); | |
548 } | |
549 LoadRoot(rax, Heap::kUndefinedValueRootIndex); | |
550 } | |
551 | |
552 | |
553 void MacroAssembler::IndexFromHash(Register hash, Register index) { | 545 void MacroAssembler::IndexFromHash(Register hash, Register index) { |
554 // The assert checks that the constants for the maximum number of digits | 546 // The assert checks that the constants for the maximum number of digits |
555 // for an array index cached in the hash field and the number of bits | 547 // for an array index cached in the hash field and the number of bits |
556 // reserved for it does not conflict. | 548 // reserved for it does not conflict. |
557 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 549 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
558 (1 << String::kArrayIndexValueBits)); | 550 (1 << String::kArrayIndexValueBits)); |
559 // We want the smi-tagged index in key. Even if we subsequently go to | 551 // We want the smi-tagged index in key. Even if we subsequently go to |
560 // the slow case, converting the key to a smi is always valid. | 552 // the slow case, converting the key to a smi is always valid. |
561 // key: string key | 553 // key: string key |
562 // hash: key's hash field, including its array index value. | 554 // hash: key's hash field, including its array index value. |
563 andp(hash, Immediate(String::kArrayIndexValueMask)); | 555 andp(hash, Immediate(String::kArrayIndexValueMask)); |
564 shrp(hash, Immediate(String::kHashShift)); | 556 shrp(hash, Immediate(String::kHashShift)); |
565 // Here we actually clobber the key which will be used if calling into | 557 // Here we actually clobber the key which will be used if calling into |
566 // runtime later. However as the new key is the numeric value of a string key | 558 // runtime later. However as the new key is the numeric value of a string key |
567 // there is no difference in using either key. | 559 // there is no difference in using either key. |
568 Integer32ToSmi(index, hash); | 560 Integer32ToSmi(index, hash); |
569 } | 561 } |
570 | 562 |
571 | 563 |
572 void MacroAssembler::CallRuntime(const Runtime::Function* f, | 564 void MacroAssembler::CallRuntime(const Runtime::Function* f, |
573 int num_arguments, | 565 int num_arguments, |
574 SaveFPRegsMode save_doubles) { | 566 SaveFPRegsMode save_doubles) { |
575 // If the expected number of arguments of the runtime function is | 567 // If the expected number of arguments of the runtime function is |
576 // constant, we check that the actual number of arguments match the | 568 // constant, we check that the actual number of arguments match the |
577 // expectation. | 569 // expectation. |
578 if (f->nargs >= 0 && f->nargs != num_arguments) { | 570 CHECK(f->nargs < 0 || f->nargs == num_arguments); |
579 IllegalOperation(num_arguments); | |
580 return; | |
581 } | |
582 | 571 |
583 // TODO(1236192): Most runtime routines don't need the number of | 572 // TODO(1236192): Most runtime routines don't need the number of |
584 // arguments passed in because it is constant. At some point we | 573 // arguments passed in because it is constant. At some point we |
585 // should remove this need and make the runtime routine entry code | 574 // should remove this need and make the runtime routine entry code |
586 // smarter. | 575 // smarter. |
587 Set(rax, num_arguments); | 576 Set(rax, num_arguments); |
588 LoadAddress(rbx, ExternalReference(f, isolate())); | 577 LoadAddress(rbx, ExternalReference(f, isolate())); |
589 CEntryStub ces(isolate(), f->result_size, save_doubles); | 578 CEntryStub ces(isolate(), f->result_size, save_doubles); |
590 CallStub(&ces); | 579 CallStub(&ces); |
591 } | 580 } |
(...skipping 4654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5246 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); | 5235 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); |
5247 movl(rax, dividend); | 5236 movl(rax, dividend); |
5248 shrl(rax, Immediate(31)); | 5237 shrl(rax, Immediate(31)); |
5249 addl(rdx, rax); | 5238 addl(rdx, rax); |
5250 } | 5239 } |
5251 | 5240 |
5252 | 5241 |
5253 } } // namespace v8::internal | 5242 } } // namespace v8::internal |
5254 | 5243 |
5255 #endif // V8_TARGET_ARCH_X64 | 5244 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |