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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 598065: Change CallIC interface on ARM. Remove name from the stack, and pass it in r... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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/arm/builtins-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 3016
3017 __ ldr(cp, frame_->Context()); 3017 __ ldr(cp, frame_->Context());
3018 // Remove the function from the stack. 3018 // Remove the function from the stack.
3019 frame_->Drop(); 3019 frame_->Drop();
3020 frame_->EmitPush(r0); 3020 frame_->EmitPush(r0);
3021 3021
3022 } else if (var != NULL && !var->is_this() && var->is_global()) { 3022 } else if (var != NULL && !var->is_this() && var->is_global()) {
3023 // ---------------------------------- 3023 // ----------------------------------
3024 // JavaScript example: 'foo(1, 2, 3)' // foo is global 3024 // JavaScript example: 'foo(1, 2, 3)' // foo is global
3025 // ---------------------------------- 3025 // ----------------------------------
3026
3027 // Push the name of the function and the receiver onto the stack.
3028 __ mov(r0, Operand(var->name()));
3029 frame_->EmitPush(r0);
3030
3031 // Pass the global object as the receiver and let the IC stub 3026 // Pass the global object as the receiver and let the IC stub
3032 // patch the stack to use the global proxy as 'this' in the 3027 // patch the stack to use the global proxy as 'this' in the
3033 // invoked function. 3028 // invoked function.
3034 LoadGlobal(); 3029 LoadGlobal();
3035 3030
3036 // Load the arguments. 3031 // Load the arguments.
3037 int arg_count = args->length(); 3032 int arg_count = args->length();
3038 for (int i = 0; i < arg_count; i++) { 3033 for (int i = 0; i < arg_count; i++) {
3039 LoadAndSpill(args->at(i)); 3034 LoadAndSpill(args->at(i));
3040 } 3035 }
3041 3036
3042 // Setup the receiver register and call the IC initialization code. 3037 // Setup the name register and call the IC initialization code.
3038 __ mov(r2, Operand(var->name()));
3043 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 3039 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
3044 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop); 3040 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop);
3045 CodeForSourcePosition(node->position()); 3041 CodeForSourcePosition(node->position());
3046 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET_CONTEXT, 3042 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET_CONTEXT,
3047 arg_count + 1); 3043 arg_count + 1);
3048 __ ldr(cp, frame_->Context()); 3044 __ ldr(cp, frame_->Context());
3049 // Remove the function from the stack.
3050 frame_->Drop();
3051 frame_->EmitPush(r0); 3045 frame_->EmitPush(r0);
3052 3046
3053 } else if (var != NULL && var->slot() != NULL && 3047 } else if (var != NULL && var->slot() != NULL &&
3054 var->slot()->type() == Slot::LOOKUP) { 3048 var->slot()->type() == Slot::LOOKUP) {
3055 // ---------------------------------- 3049 // ----------------------------------
3056 // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj 3050 // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj
3057 // ---------------------------------- 3051 // ----------------------------------
3058 3052
3059 // Load the function 3053 // Load the function
3060 frame_->EmitPush(cp); 3054 frame_->EmitPush(cp);
(...skipping 12 matching lines...) Expand all
3073 3067
3074 } else if (property != NULL) { 3068 } else if (property != NULL) {
3075 // Check if the key is a literal string. 3069 // Check if the key is a literal string.
3076 Literal* literal = property->key()->AsLiteral(); 3070 Literal* literal = property->key()->AsLiteral();
3077 3071
3078 if (literal != NULL && literal->handle()->IsSymbol()) { 3072 if (literal != NULL && literal->handle()->IsSymbol()) {
3079 // ------------------------------------------------------------------ 3073 // ------------------------------------------------------------------
3080 // JavaScript example: 'object.foo(1, 2, 3)' or 'map["key"](1, 2, 3)' 3074 // JavaScript example: 'object.foo(1, 2, 3)' or 'map["key"](1, 2, 3)'
3081 // ------------------------------------------------------------------ 3075 // ------------------------------------------------------------------
3082 3076
3083 // Push the name of the function and the receiver onto the stack. 3077 LoadAndSpill(property->obj()); // Receiver.
3084 __ mov(r0, Operand(literal->handle()));
3085 frame_->EmitPush(r0);
3086 LoadAndSpill(property->obj());
3087
3088 // Load the arguments. 3078 // Load the arguments.
3089 int arg_count = args->length(); 3079 int arg_count = args->length();
3090 for (int i = 0; i < arg_count; i++) { 3080 for (int i = 0; i < arg_count; i++) {
3091 LoadAndSpill(args->at(i)); 3081 LoadAndSpill(args->at(i));
3092 } 3082 }
3093 3083
3094 // Set the receiver register and call the IC initialization code. 3084 // Set the name register and call the IC initialization code.
3085 __ mov(r2, Operand(literal->handle()));
3095 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 3086 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
3096 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop); 3087 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop);
3097 CodeForSourcePosition(node->position()); 3088 CodeForSourcePosition(node->position());
3098 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 3089 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
3099 __ ldr(cp, frame_->Context()); 3090 __ ldr(cp, frame_->Context());
3100 3091 frame_->EmitPush(r0);
3101 // Remove the function from the stack.
3102 frame_->Drop();
3103
3104 frame_->EmitPush(r0); // push after get rid of function from the stack
3105 3092
3106 } else { 3093 } else {
3107 // ------------------------------------------- 3094 // -------------------------------------------
3108 // JavaScript example: 'array[index](1, 2, 3)' 3095 // JavaScript example: 'array[index](1, 2, 3)'
3109 // ------------------------------------------- 3096 // -------------------------------------------
3110 3097
3111 LoadAndSpill(property->obj()); 3098 LoadAndSpill(property->obj());
3112 LoadAndSpill(property->key()); 3099 LoadAndSpill(property->key());
3113 EmitKeyedLoad(false); 3100 EmitKeyedLoad(false);
3114 frame_->Drop(); // key 3101 frame_->Drop(); // key
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3629 (!has_cc() && frame_->height() == original_height + 1)); 3616 (!has_cc() && frame_->height() == original_height + 1));
3630 return; 3617 return;
3631 } 3618 }
3632 3619
3633 ZoneList<Expression*>* args = node->arguments(); 3620 ZoneList<Expression*>* args = node->arguments();
3634 Comment cmnt(masm_, "[ CallRuntime"); 3621 Comment cmnt(masm_, "[ CallRuntime");
3635 Runtime::Function* function = node->function(); 3622 Runtime::Function* function = node->function();
3636 3623
3637 if (function == NULL) { 3624 if (function == NULL) {
3638 // Prepare stack for calling JS runtime function. 3625 // Prepare stack for calling JS runtime function.
3639 __ mov(r0, Operand(node->name()));
3640 frame_->EmitPush(r0);
3641 // Push the builtins object found in the current global object. 3626 // Push the builtins object found in the current global object.
3642 __ ldr(r1, GlobalObject()); 3627 __ ldr(r1, GlobalObject());
3643 __ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset)); 3628 __ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset));
3644 frame_->EmitPush(r0); 3629 frame_->EmitPush(r0);
3645 } 3630 }
3646 3631
3647 // Push the arguments ("left-to-right"). 3632 // Push the arguments ("left-to-right").
3648 int arg_count = args->length(); 3633 int arg_count = args->length();
3649 for (int i = 0; i < arg_count; i++) { 3634 for (int i = 0; i < arg_count; i++) {
3650 LoadAndSpill(args->at(i)); 3635 LoadAndSpill(args->at(i));
3651 } 3636 }
3652 3637
3653 if (function == NULL) { 3638 if (function == NULL) {
3654 // Call the JS runtime function. 3639 // Call the JS runtime function.
3640 __ mov(r2, Operand(node->name()));
3655 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 3641 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
3656 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop); 3642 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop);
3657 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 3643 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
3658 __ ldr(cp, frame_->Context()); 3644 __ ldr(cp, frame_->Context());
3659 frame_->Drop();
3660 frame_->EmitPush(r0); 3645 frame_->EmitPush(r0);
3661 } else { 3646 } else {
3662 // Call the C runtime function. 3647 // Call the C runtime function.
3663 frame_->CallRuntime(function, arg_count); 3648 frame_->CallRuntime(function, arg_count);
3664 frame_->EmitPush(r0); 3649 frame_->EmitPush(r0);
3665 } 3650 }
3666 ASSERT(frame_->height() == original_height + 1); 3651 ASSERT(frame_->height() == original_height + 1);
3667 } 3652 }
3668 3653
3669 3654
(...skipping 3864 matching lines...) Expand 10 before | Expand all | Expand 10 after
7534 7519
7535 // Just jump to runtime to add the two strings. 7520 // Just jump to runtime to add the two strings.
7536 __ bind(&string_add_runtime); 7521 __ bind(&string_add_runtime);
7537 __ TailCallRuntime(ExternalReference(Runtime::kStringAdd), 2, 1); 7522 __ TailCallRuntime(ExternalReference(Runtime::kStringAdd), 2, 1);
7538 } 7523 }
7539 7524
7540 7525
7541 #undef __ 7526 #undef __
7542 7527
7543 } } // namespace v8::internal 7528 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698