Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 535873002: Encapsulate megamorphic load/tail-call in hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic/x64/stub-cache-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
11 #include "src/hydrogen-osr.h" 11 #include "src/hydrogen-osr.h"
12 #include "src/ic/stub-cache.h"
12 #include "src/x64/lithium-codegen-x64.h" 13 #include "src/x64/lithium-codegen-x64.h"
13 14
14 namespace v8 { 15 namespace v8 {
15 namespace internal { 16 namespace internal {
16 17
17 18
18 // When invoking builtins, we need to record the safepoint in the middle of 19 // When invoking builtins, we need to record the safepoint in the middle of
19 // the invoke instruction sequence generated by the macro assembler. 20 // the invoke instruction sequence generated by the macro assembler.
20 class SafepointGenerator FINAL : public CallWrapper { 21 class SafepointGenerator FINAL : public CallWrapper {
21 public: 22 public:
(...skipping 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 Representation::Smi()); 3221 Representation::Smi());
3221 __ AssertSmi(scratch); 3222 __ AssertSmi(scratch);
3222 } 3223 }
3223 // Read int value directly from upper half of the smi. 3224 // Read int value directly from upper half of the smi.
3224 STATIC_ASSERT(kSmiTag == 0); 3225 STATIC_ASSERT(kSmiTag == 0);
3225 DCHECK(kSmiTagSize + kSmiShiftSize == 32); 3226 DCHECK(kSmiTagSize + kSmiShiftSize == 32);
3226 offset += kPointerSize / 2; 3227 offset += kPointerSize / 2;
3227 } 3228 }
3228 3229
3229 __ Load(result, 3230 __ Load(result,
3230 BuildFastArrayOperand(instr->elements(), 3231 BuildFastArrayOperand(instr->elements(), key,
3231 key,
3232 instr->hydrogen()->key()->representation(), 3232 instr->hydrogen()->key()->representation(),
3233 FAST_ELEMENTS, 3233 FAST_ELEMENTS, offset),
3234 offset),
3235 representation); 3234 representation);
3236 3235
3237 // Check for the hole value. 3236 // Check for the hole value.
3238 if (requires_hole_check) { 3237 if (requires_hole_check) {
3239 if (IsFastSmiElementsKind(hinstr->elements_kind())) { 3238 if (IsFastSmiElementsKind(hinstr->elements_kind())) {
3240 Condition smi = __ CheckSmi(result); 3239 Condition smi = __ CheckSmi(result);
3241 DeoptimizeIf(NegateCondition(smi), instr->environment()); 3240 DeoptimizeIf(NegateCondition(smi), instr->environment());
3242 } else { 3241 } else {
3243 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); 3242 __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
3244 DeoptimizeIf(equal, instr->environment()); 3243 DeoptimizeIf(equal, instr->environment());
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3524 // We need to adapt arguments. 3523 // We need to adapt arguments.
3525 SafepointGenerator generator( 3524 SafepointGenerator generator(
3526 this, pointers, Safepoint::kLazyDeopt); 3525 this, pointers, Safepoint::kLazyDeopt);
3527 ParameterCount count(arity); 3526 ParameterCount count(arity);
3528 ParameterCount expected(formal_parameter_count); 3527 ParameterCount expected(formal_parameter_count);
3529 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); 3528 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
3530 } 3529 }
3531 } 3530 }
3532 3531
3533 3532
3533 void LCodeGen::DoTailCallThroughMegamorphicCache(
3534 LTailCallThroughMegamorphicCache* instr) {
3535 Register receiver = ToRegister(instr->receiver());
3536 Register name = ToRegister(instr->name());
3537 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister()));
3538 DCHECK(name.is(LoadDescriptor::NameRegister()));
3539
3540 Register scratch = rbx;
3541 DCHECK(!scratch.is(receiver) && !scratch.is(name));
3542
3543 // Important for the tail-call.
3544 bool must_teardown_frame = NeedsEagerFrame();
3545
3546 // The probe will tail call to a handler if found.
3547 isolate()->stub_cache()->GenerateProbe(masm(), instr->hydrogen()->flags(),
3548 must_teardown_frame, receiver, name,
3549 scratch, no_reg);
3550
3551 // Tail call to miss if we ended up here.
3552 if (must_teardown_frame) __ leave();
3553 LoadIC::GenerateMiss(masm());
3554 }
3555
3556
3534 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { 3557 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) {
3535 DCHECK(ToRegister(instr->result()).is(rax)); 3558 DCHECK(ToRegister(instr->result()).is(rax));
3536 3559
3537 LPointerMap* pointers = instr->pointer_map(); 3560 LPointerMap* pointers = instr->pointer_map();
3538 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3561 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3539 3562
3540 if (instr->target()->IsConstantOperand()) { 3563 if (instr->target()->IsConstantOperand()) {
3541 LConstantOperand* target = LConstantOperand::cast(instr->target()); 3564 LConstantOperand* target = LConstantOperand::cast(instr->target());
3542 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); 3565 Handle<Code> code = Handle<Code>::cast(ToHandle(target));
3543 generator.BeforeCall(__ CallSize(code)); 3566 generator.BeforeCall(__ CallSize(code));
(...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after
5852 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5875 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5853 RecordSafepoint(Safepoint::kNoLazyDeopt); 5876 RecordSafepoint(Safepoint::kNoLazyDeopt);
5854 } 5877 }
5855 5878
5856 5879
5857 #undef __ 5880 #undef __
5858 5881
5859 } } // namespace v8::internal 5882 } } // namespace v8::internal
5860 5883
5861 #endif // V8_TARGET_ARCH_X64 5884 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/x64/stub-cache-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698