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

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

Issue 7086029: Fix a number of IC stubs to correctly set the call kind. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Load global object from rsi on x64. Created 9 years, 6 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/x64/ic-x64.cc ('k') | src/x64/macro-assembler-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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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
(...skipping 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 2601
2602 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { 2602 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2603 Register receiver = ToRegister(instr->receiver()); 2603 Register receiver = ToRegister(instr->receiver());
2604 Register function = ToRegister(instr->function()); 2604 Register function = ToRegister(instr->function());
2605 Register length = ToRegister(instr->length()); 2605 Register length = ToRegister(instr->length());
2606 Register elements = ToRegister(instr->elements()); 2606 Register elements = ToRegister(instr->elements());
2607 ASSERT(receiver.is(rax)); // Used for parameter count. 2607 ASSERT(receiver.is(rax)); // Used for parameter count.
2608 ASSERT(function.is(rdi)); // Required by InvokeFunction. 2608 ASSERT(function.is(rdi)); // Required by InvokeFunction.
2609 ASSERT(ToRegister(instr->result()).is(rax)); 2609 ASSERT(ToRegister(instr->result()).is(rax));
2610 2610
2611 // TODO(1412): This is not correct if the called function is a
2612 // strict mode function or a native.
2613 //
2611 // If the receiver is null or undefined, we have to pass the global object 2614 // If the receiver is null or undefined, we have to pass the global object
2612 // as a receiver. 2615 // as a receiver.
2613 Label global_object, receiver_ok; 2616 Label global_object, receiver_ok;
2614 __ CompareRoot(receiver, Heap::kNullValueRootIndex); 2617 __ CompareRoot(receiver, Heap::kNullValueRootIndex);
2615 __ j(equal, &global_object, Label::kNear); 2618 __ j(equal, &global_object, Label::kNear);
2616 __ CompareRoot(receiver, Heap::kUndefinedValueRootIndex); 2619 __ CompareRoot(receiver, Heap::kUndefinedValueRootIndex);
2617 __ j(equal, &global_object, Label::kNear); 2620 __ j(equal, &global_object, Label::kNear);
2618 2621
2619 // The receiver should be a JS object. 2622 // The receiver should be a JS object.
2620 Condition is_smi = __ CheckSmi(receiver); 2623 Condition is_smi = __ CheckSmi(receiver);
2621 DeoptimizeIf(is_smi, instr->environment()); 2624 DeoptimizeIf(is_smi, instr->environment());
2622 __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, kScratchRegister); 2625 __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, kScratchRegister);
2623 DeoptimizeIf(below, instr->environment()); 2626 DeoptimizeIf(below, instr->environment());
2624 __ jmp(&receiver_ok, Label::kNear); 2627 __ jmp(&receiver_ok, Label::kNear);
2625 2628
2626 __ bind(&global_object); 2629 __ bind(&global_object);
2627 // TODO(kmillikin): We have a hydrogen value for the global object. See 2630 // TODO(kmillikin): We have a hydrogen value for the global object. See
2628 // if it's better to use it than to explicitly fetch it from the context 2631 // if it's better to use it than to explicitly fetch it from the context
2629 // here. 2632 // here.
2630 __ movq(receiver, Operand(rbp, StandardFrameConstants::kContextOffset)); 2633 __ movq(receiver, ContextOperand(rsi, Context::GLOBAL_INDEX));
2631 __ movq(receiver, ContextOperand(receiver, Context::GLOBAL_INDEX)); 2634 __ movq(receiver,
2635 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset));
2632 __ bind(&receiver_ok); 2636 __ bind(&receiver_ok);
2633 2637
2634 // Copy the arguments to this function possibly from the 2638 // Copy the arguments to this function possibly from the
2635 // adaptor frame below it. 2639 // adaptor frame below it.
2636 const uint32_t kArgumentsLimit = 1 * KB; 2640 const uint32_t kArgumentsLimit = 1 * KB;
2637 __ cmpq(length, Immediate(kArgumentsLimit)); 2641 __ cmpq(length, Immediate(kArgumentsLimit));
2638 DeoptimizeIf(above, instr->environment()); 2642 DeoptimizeIf(above, instr->environment());
2639 2643
2640 __ push(receiver); 2644 __ push(receiver);
2641 __ movq(receiver, length); 2645 __ movq(receiver, length);
(...skipping 13 matching lines...) Expand all
2655 __ bind(&invoke); 2659 __ bind(&invoke);
2656 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); 2660 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2657 LPointerMap* pointers = instr->pointer_map(); 2661 LPointerMap* pointers = instr->pointer_map();
2658 LEnvironment* env = instr->deoptimization_environment(); 2662 LEnvironment* env = instr->deoptimization_environment();
2659 RecordPosition(pointers->position()); 2663 RecordPosition(pointers->position());
2660 RegisterEnvironmentForDeoptimization(env); 2664 RegisterEnvironmentForDeoptimization(env);
2661 SafepointGenerator safepoint_generator(this, 2665 SafepointGenerator safepoint_generator(this,
2662 pointers, 2666 pointers,
2663 env->deoptimization_index()); 2667 env->deoptimization_index());
2664 v8::internal::ParameterCount actual(rax); 2668 v8::internal::ParameterCount actual(rax);
2665 __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator); 2669 __ InvokeFunction(function, actual, CALL_FUNCTION,
2670 safepoint_generator, CALL_AS_METHOD);
2666 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2671 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2667 } 2672 }
2668 2673
2669 2674
2670 void LCodeGen::DoPushArgument(LPushArgument* instr) { 2675 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2671 LOperand* argument = instr->InputAt(0); 2676 LOperand* argument = instr->InputAt(0);
2672 EmitPushTaggedOperand(argument); 2677 EmitPushTaggedOperand(argument);
2673 } 2678 }
2674 2679
2675 2680
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { 3073 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3069 ASSERT(ToRegister(instr->function()).is(rdi)); 3074 ASSERT(ToRegister(instr->function()).is(rdi));
3070 ASSERT(instr->HasPointerMap()); 3075 ASSERT(instr->HasPointerMap());
3071 ASSERT(instr->HasDeoptimizationEnvironment()); 3076 ASSERT(instr->HasDeoptimizationEnvironment());
3072 LPointerMap* pointers = instr->pointer_map(); 3077 LPointerMap* pointers = instr->pointer_map();
3073 LEnvironment* env = instr->deoptimization_environment(); 3078 LEnvironment* env = instr->deoptimization_environment();
3074 RecordPosition(pointers->position()); 3079 RecordPosition(pointers->position());
3075 RegisterEnvironmentForDeoptimization(env); 3080 RegisterEnvironmentForDeoptimization(env);
3076 SafepointGenerator generator(this, pointers, env->deoptimization_index()); 3081 SafepointGenerator generator(this, pointers, env->deoptimization_index());
3077 ParameterCount count(instr->arity()); 3082 ParameterCount count(instr->arity());
3078 __ InvokeFunction(rdi, count, CALL_FUNCTION, generator); 3083 __ InvokeFunction(rdi, count, CALL_FUNCTION, generator, CALL_AS_METHOD);
3079 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 3084 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3080 } 3085 }
3081 3086
3082 3087
3083 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { 3088 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
3084 ASSERT(ToRegister(instr->key()).is(rcx)); 3089 ASSERT(ToRegister(instr->key()).is(rcx));
3085 ASSERT(ToRegister(instr->result()).is(rax)); 3090 ASSERT(ToRegister(instr->result()).is(rax));
3086 3091
3087 int arity = instr->arity(); 3092 int arity = instr->arity();
3088 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize( 3093 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
4258 RegisterEnvironmentForDeoptimization(environment); 4263 RegisterEnvironmentForDeoptimization(environment);
4259 ASSERT(osr_pc_offset_ == -1); 4264 ASSERT(osr_pc_offset_ == -1);
4260 osr_pc_offset_ = masm()->pc_offset(); 4265 osr_pc_offset_ = masm()->pc_offset();
4261 } 4266 }
4262 4267
4263 #undef __ 4268 #undef __
4264 4269
4265 } } // namespace v8::internal 4270 } } // namespace v8::internal
4266 4271
4267 #endif // V8_TARGET_ARCH_X64 4272 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698