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

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

Issue 5161002: Change the order of evaluation of sub-expressions for keyed call... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 1 month 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 | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')
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 4321 matching lines...) Expand 10 before | Expand all | Expand 10 after
4332 CodeForSourcePosition(node->position()); 4332 CodeForSourcePosition(node->position());
4333 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 4333 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
4334 __ ldr(cp, frame_->Context()); 4334 __ ldr(cp, frame_->Context());
4335 frame_->EmitPush(r0); 4335 frame_->EmitPush(r0);
4336 } 4336 }
4337 4337
4338 } else { 4338 } else {
4339 // ------------------------------------------- 4339 // -------------------------------------------
4340 // JavaScript example: 'array[index](1, 2, 3)' 4340 // JavaScript example: 'array[index](1, 2, 3)'
4341 // ------------------------------------------- 4341 // -------------------------------------------
4342
4343 // Load the receiver and name of the function.
4342 Load(property->obj()); 4344 Load(property->obj());
4345 Load(property->key());
4346
4343 if (property->is_synthetic()) { 4347 if (property->is_synthetic()) {
4344 Load(property->key());
4345 EmitKeyedLoad(); 4348 EmitKeyedLoad();
4346 // Put the function below the receiver. 4349 // Put the function below the receiver.
4347 // Use the global receiver. 4350 // Use the global receiver.
4348 frame_->EmitPush(r0); // Function. 4351 frame_->EmitPush(r0); // Function.
4349 LoadGlobalReceiver(VirtualFrame::scratch0()); 4352 LoadGlobalReceiver(VirtualFrame::scratch0());
4350 // Call the function. 4353 // Call the function.
4351 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position()); 4354 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position());
4352 frame_->EmitPush(r0); 4355 frame_->EmitPush(r0);
4353 } else { 4356 } else {
4357 // Swap the name of the function and the receiver on the stack to have
4358 // a stack image common for calls using an IC (receiver followed by
Mads Ager (chromium) 2010/11/17 13:11:37 Swap the ... to follow the calling convention for
Søren Thygesen Gjesse 2010/11/18 08:48:57 Done.
4359 // arguments).
4360 Register key = frame_->PopToRegister();
4361 Register receiver = frame_->PopToRegister(key);
4362 frame_->EmitPush(key);
4363 frame_->EmitPush(receiver);
4364
4354 // Load the arguments. 4365 // Load the arguments.
4355 int arg_count = args->length(); 4366 int arg_count = args->length();
4356 for (int i = 0; i < arg_count; i++) { 4367 for (int i = 0; i < arg_count; i++) {
4357 Load(args->at(i)); 4368 Load(args->at(i));
4358 } 4369 }
4359 4370
4360 // Set the name register and call the IC initialization code. 4371 // Load the key into r2 and call the IC initialization code.
4361 Load(property->key());
4362 frame_->SpillAll();
4363 frame_->EmitPop(r2); // Function name.
4364
4365 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 4372 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4366 Handle<Code> stub = 4373 Handle<Code> stub =
4367 StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); 4374 StubCache::ComputeKeyedCallInitialize(arg_count, in_loop);
4368 CodeForSourcePosition(node->position()); 4375 CodeForSourcePosition(node->position());
4376 frame_->SpillAll();
4377 __ ldr(r2, frame_->ElementAt(arg_count + 1));
4369 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 4378 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
4379 frame_->Drop(); // Drop the key still on the stack.
4370 __ ldr(cp, frame_->Context()); 4380 __ ldr(cp, frame_->Context());
4371 frame_->EmitPush(r0); 4381 frame_->EmitPush(r0);
4372 } 4382 }
4373 } 4383 }
4374 4384
4375 } else { 4385 } else {
4376 // ---------------------------------- 4386 // ----------------------------------
4377 // JavaScript example: 'foo(1, 2, 3)' // foo is not global 4387 // JavaScript example: 'foo(1, 2, 3)' // foo is not global
4378 // ---------------------------------- 4388 // ----------------------------------
4379 4389
(...skipping 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after
7259 BinaryOpIC::GetName(runtime_operands_type_)); 7269 BinaryOpIC::GetName(runtime_operands_type_));
7260 return name_; 7270 return name_;
7261 } 7271 }
7262 7272
7263 7273
7264 #undef __ 7274 #undef __
7265 7275
7266 } } // namespace v8::internal 7276 } } // namespace v8::internal
7267 7277
7268 #endif // V8_TARGET_ARCH_ARM 7278 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698