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

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') | 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 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 follow
4358 // the calling convention for call ICs.
4359 Register key = frame_->PopToRegister();
4360 Register receiver = frame_->PopToRegister(key);
4361 frame_->EmitPush(key);
4362 frame_->EmitPush(receiver);
4363
4354 // Load the arguments. 4364 // Load the arguments.
4355 int arg_count = args->length(); 4365 int arg_count = args->length();
4356 for (int i = 0; i < arg_count; i++) { 4366 for (int i = 0; i < arg_count; i++) {
4357 Load(args->at(i)); 4367 Load(args->at(i));
4358 } 4368 }
4359 4369
4360 // Set the name register and call the IC initialization code. 4370 // 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; 4371 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4366 Handle<Code> stub = 4372 Handle<Code> stub =
4367 StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); 4373 StubCache::ComputeKeyedCallInitialize(arg_count, in_loop);
4368 CodeForSourcePosition(node->position()); 4374 CodeForSourcePosition(node->position());
4375 frame_->SpillAll();
4376 __ ldr(r2, frame_->ElementAt(arg_count + 1));
4369 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 4377 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
4378 frame_->Drop(); // Drop the key still on the stack.
4370 __ ldr(cp, frame_->Context()); 4379 __ ldr(cp, frame_->Context());
4371 frame_->EmitPush(r0); 4380 frame_->EmitPush(r0);
4372 } 4381 }
4373 } 4382 }
4374 4383
4375 } else { 4384 } else {
4376 // ---------------------------------- 4385 // ----------------------------------
4377 // JavaScript example: 'foo(1, 2, 3)' // foo is not global 4386 // JavaScript example: 'foo(1, 2, 3)' // foo is not global
4378 // ---------------------------------- 4387 // ----------------------------------
4379 4388
(...skipping 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after
7259 BinaryOpIC::GetName(runtime_operands_type_)); 7268 BinaryOpIC::GetName(runtime_operands_type_));
7260 return name_; 7269 return name_;
7261 } 7270 }
7262 7271
7263 7272
7264 #undef __ 7273 #undef __
7265 7274
7266 } } // namespace v8::internal 7275 } } // namespace v8::internal
7267 7276
7268 #endif // V8_TARGET_ARCH_ARM 7277 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698