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

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

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
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 | « src/arm/codegen-arm.h ('k') | src/arm/disasm-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 25 matching lines...) Expand all
36 #include "debug.h" 36 #include "debug.h"
37 #include "ic-inl.h" 37 #include "ic-inl.h"
38 #include "jsregexp.h" 38 #include "jsregexp.h"
39 #include "jump-target-light-inl.h" 39 #include "jump-target-light-inl.h"
40 #include "parser.h" 40 #include "parser.h"
41 #include "regexp-macro-assembler.h" 41 #include "regexp-macro-assembler.h"
42 #include "regexp-stack.h" 42 #include "regexp-stack.h"
43 #include "register-allocator-inl.h" 43 #include "register-allocator-inl.h"
44 #include "runtime.h" 44 #include "runtime.h"
45 #include "scopes.h" 45 #include "scopes.h"
46 #include "stub-cache.h"
46 #include "virtual-frame-inl.h" 47 #include "virtual-frame-inl.h"
47 #include "virtual-frame-arm-inl.h" 48 #include "virtual-frame-arm-inl.h"
48 49
49 namespace v8 { 50 namespace v8 {
50 namespace internal { 51 namespace internal {
51 52
52 53
53 #define __ ACCESS_MASM(masm_) 54 #define __ ACCESS_MASM(masm_)
54 55
55 // ------------------------------------------------------------------------- 56 // -------------------------------------------------------------------------
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 loaded.Bind(); 551 loaded.Bind();
551 } 552 }
552 ASSERT(has_valid_frame()); 553 ASSERT(has_valid_frame());
553 ASSERT(!has_cc()); 554 ASSERT(!has_cc());
554 ASSERT_EQ(original_height + 1, frame_->height()); 555 ASSERT_EQ(original_height + 1, frame_->height());
555 } 556 }
556 557
557 558
558 void CodeGenerator::LoadGlobal() { 559 void CodeGenerator::LoadGlobal() {
559 Register reg = frame_->GetTOSRegister(); 560 Register reg = frame_->GetTOSRegister();
560 __ ldr(reg, GlobalObject()); 561 __ ldr(reg, GlobalObjectOperand());
561 frame_->EmitPush(reg); 562 frame_->EmitPush(reg);
562 } 563 }
563 564
564 565
565 void CodeGenerator::LoadGlobalReceiver(Register scratch) { 566 void CodeGenerator::LoadGlobalReceiver(Register scratch) {
566 Register reg = frame_->GetTOSRegister(); 567 Register reg = frame_->GetTOSRegister();
567 __ ldr(reg, ContextOperand(cp, Context::GLOBAL_INDEX)); 568 __ ldr(reg, ContextOperand(cp, Context::GLOBAL_INDEX));
568 __ ldr(reg, 569 __ ldr(reg,
569 FieldMemOperand(reg, GlobalObject::kGlobalReceiverOffset)); 570 FieldMemOperand(reg, GlobalObject::kGlobalReceiverOffset));
570 frame_->EmitPush(reg); 571 frame_->EmitPush(reg);
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 Condition cc = if_true ? cc_reg_ : NegateCondition(cc_reg_); 1885 Condition cc = if_true ? cc_reg_ : NegateCondition(cc_reg_);
1885 target->Branch(cc); 1886 target->Branch(cc);
1886 cc_reg_ = al; 1887 cc_reg_ = al;
1887 } 1888 }
1888 1889
1889 1890
1890 void CodeGenerator::CheckStack() { 1891 void CodeGenerator::CheckStack() {
1891 frame_->SpillAll(); 1892 frame_->SpillAll();
1892 Comment cmnt(masm_, "[ check stack"); 1893 Comment cmnt(masm_, "[ check stack");
1893 __ LoadRoot(ip, Heap::kStackLimitRootIndex); 1894 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
1894 // Put the lr setup instruction in the delay slot. kInstrSize is added to
1895 // the implicit 8 byte offset that always applies to operations with pc and
1896 // gives a return address 12 bytes down.
1897 masm_->add(lr, pc, Operand(Assembler::kInstrSize));
1898 masm_->cmp(sp, Operand(ip)); 1895 masm_->cmp(sp, Operand(ip));
1899 StackCheckStub stub; 1896 StackCheckStub stub;
1900 // Call the stub if lower. 1897 // Call the stub if lower.
1901 masm_->mov(pc, 1898 masm_->mov(ip,
1902 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), 1899 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()),
1903 RelocInfo::CODE_TARGET), 1900 RelocInfo::CODE_TARGET),
1904 LeaveCC, 1901 LeaveCC,
1905 lo); 1902 lo);
1903 masm_->Call(ip, lo);
1906 } 1904 }
1907 1905
1908 1906
1909 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) { 1907 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) {
1910 #ifdef DEBUG 1908 #ifdef DEBUG
1911 int original_height = frame_->height(); 1909 int original_height = frame_->height();
1912 #endif 1910 #endif
1913 for (int i = 0; frame_ != NULL && i < statements->length(); i++) { 1911 for (int i = 0; frame_ != NULL && i < statements->length(); i++) {
1914 Visit(statements->at(i)); 1912 Visit(statements->at(i));
1915 } 1913 }
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
4225 // Load the arguments. 4223 // Load the arguments.
4226 int arg_count = args->length(); 4224 int arg_count = args->length();
4227 for (int i = 0; i < arg_count; i++) { 4225 for (int i = 0; i < arg_count; i++) {
4228 Load(args->at(i)); 4226 Load(args->at(i));
4229 } 4227 }
4230 4228
4231 VirtualFrame::SpilledScope spilled_scope(frame_); 4229 VirtualFrame::SpilledScope spilled_scope(frame_);
4232 // Setup the name register and call the IC initialization code. 4230 // Setup the name register and call the IC initialization code.
4233 __ mov(r2, Operand(var->name())); 4231 __ mov(r2, Operand(var->name()));
4234 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 4232 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4235 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop); 4233 Handle<Code> stub = StubCache::ComputeCallInitialize(arg_count, in_loop);
4236 CodeForSourcePosition(node->position()); 4234 CodeForSourcePosition(node->position());
4237 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET_CONTEXT, 4235 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET_CONTEXT,
4238 arg_count + 1); 4236 arg_count + 1);
4239 __ ldr(cp, frame_->Context()); 4237 __ ldr(cp, frame_->Context());
4240 frame_->EmitPush(r0); 4238 frame_->EmitPush(r0);
4241 4239
4242 } else if (var != NULL && var->AsSlot() != NULL && 4240 } else if (var != NULL && var->AsSlot() != NULL &&
4243 var->AsSlot()->type() == Slot::LOOKUP) { 4241 var->AsSlot()->type() == Slot::LOOKUP) {
4244 // ---------------------------------- 4242 // ----------------------------------
4245 // JavaScript examples: 4243 // JavaScript examples:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4319 // Load the arguments. 4317 // Load the arguments.
4320 int arg_count = args->length(); 4318 int arg_count = args->length();
4321 for (int i = 0; i < arg_count; i++) { 4319 for (int i = 0; i < arg_count; i++) {
4322 Load(args->at(i)); 4320 Load(args->at(i));
4323 } 4321 }
4324 4322
4325 VirtualFrame::SpilledScope spilled_scope(frame_); 4323 VirtualFrame::SpilledScope spilled_scope(frame_);
4326 // Set the name register and call the IC initialization code. 4324 // Set the name register and call the IC initialization code.
4327 __ mov(r2, Operand(name)); 4325 __ mov(r2, Operand(name));
4328 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 4326 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4329 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop); 4327 Handle<Code> stub =
4328 StubCache::ComputeCallInitialize(arg_count, in_loop);
4330 CodeForSourcePosition(node->position()); 4329 CodeForSourcePosition(node->position());
4331 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 4330 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
4332 __ ldr(cp, frame_->Context()); 4331 __ ldr(cp, frame_->Context());
4333 frame_->EmitPush(r0); 4332 frame_->EmitPush(r0);
4334 } 4333 }
4335 4334
4336 } else { 4335 } else {
4337 // ------------------------------------------- 4336 // -------------------------------------------
4338 // JavaScript example: 'array[index](1, 2, 3)' 4337 // JavaScript example: 'array[index](1, 2, 3)'
4339 // ------------------------------------------- 4338 // -------------------------------------------
4339
4340 // Load the receiver and name of the function.
4340 Load(property->obj()); 4341 Load(property->obj());
4342 Load(property->key());
4343
4341 if (property->is_synthetic()) { 4344 if (property->is_synthetic()) {
4342 Load(property->key());
4343 EmitKeyedLoad(); 4345 EmitKeyedLoad();
4344 // Put the function below the receiver. 4346 // Put the function below the receiver.
4345 // Use the global receiver. 4347 // Use the global receiver.
4346 frame_->EmitPush(r0); // Function. 4348 frame_->EmitPush(r0); // Function.
4347 LoadGlobalReceiver(VirtualFrame::scratch0()); 4349 LoadGlobalReceiver(VirtualFrame::scratch0());
4348 // Call the function. 4350 // Call the function.
4349 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position()); 4351 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position());
4350 frame_->EmitPush(r0); 4352 frame_->EmitPush(r0);
4351 } else { 4353 } else {
4354 // Swap the name of the function and the receiver on the stack to follow
4355 // the calling convention for call ICs.
4356 Register key = frame_->PopToRegister();
4357 Register receiver = frame_->PopToRegister(key);
4358 frame_->EmitPush(key);
4359 frame_->EmitPush(receiver);
4360
4352 // Load the arguments. 4361 // Load the arguments.
4353 int arg_count = args->length(); 4362 int arg_count = args->length();
4354 for (int i = 0; i < arg_count; i++) { 4363 for (int i = 0; i < arg_count; i++) {
4355 Load(args->at(i)); 4364 Load(args->at(i));
4356 } 4365 }
4357 4366
4358 // Set the name register and call the IC initialization code. 4367 // Load the key into r2 and call the IC initialization code.
4359 Load(property->key()); 4368 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4369 Handle<Code> stub =
4370 StubCache::ComputeKeyedCallInitialize(arg_count, in_loop);
4371 CodeForSourcePosition(node->position());
4360 frame_->SpillAll(); 4372 frame_->SpillAll();
4361 frame_->EmitPop(r2); // Function name. 4373 __ ldr(r2, frame_->ElementAt(arg_count + 1));
4362
4363 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
4364 Handle<Code> stub = ComputeKeyedCallInitialize(arg_count, in_loop);
4365 CodeForSourcePosition(node->position());
4366 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 4374 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
4375 frame_->Drop(); // Drop the key still on the stack.
4367 __ ldr(cp, frame_->Context()); 4376 __ ldr(cp, frame_->Context());
4368 frame_->EmitPush(r0); 4377 frame_->EmitPush(r0);
4369 } 4378 }
4370 } 4379 }
4371 4380
4372 } else { 4381 } else {
4373 // ---------------------------------- 4382 // ----------------------------------
4374 // JavaScript example: 'foo(1, 2, 3)' // foo is not global 4383 // JavaScript example: 'foo(1, 2, 3)' // foo is not global
4375 // ---------------------------------- 4384 // ----------------------------------
4376 4385
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
5128 // Reload map as register map_result_ was used as temporary above. 5137 // Reload map as register map_result_ was used as temporary above.
5129 __ ldr(map_result_, FieldMemOperand(object_, HeapObject::kMapOffset)); 5138 __ ldr(map_result_, FieldMemOperand(object_, HeapObject::kMapOffset));
5130 5139
5131 // If a valueOf property is not found on the object check that it's 5140 // If a valueOf property is not found on the object check that it's
5132 // prototype is the un-modified String prototype. If not result is false. 5141 // prototype is the un-modified String prototype. If not result is false.
5133 __ ldr(scratch1_, FieldMemOperand(map_result_, Map::kPrototypeOffset)); 5142 __ ldr(scratch1_, FieldMemOperand(map_result_, Map::kPrototypeOffset));
5134 __ tst(scratch1_, Operand(kSmiTagMask)); 5143 __ tst(scratch1_, Operand(kSmiTagMask));
5135 __ b(eq, &false_result); 5144 __ b(eq, &false_result);
5136 __ ldr(scratch1_, FieldMemOperand(scratch1_, HeapObject::kMapOffset)); 5145 __ ldr(scratch1_, FieldMemOperand(scratch1_, HeapObject::kMapOffset));
5137 __ ldr(scratch2_, 5146 __ ldr(scratch2_,
5138 CodeGenerator::ContextOperand(cp, Context::GLOBAL_INDEX)); 5147 ContextOperand(cp, Context::GLOBAL_INDEX));
5139 __ ldr(scratch2_, 5148 __ ldr(scratch2_,
5140 FieldMemOperand(scratch2_, GlobalObject::kGlobalContextOffset)); 5149 FieldMemOperand(scratch2_, GlobalObject::kGlobalContextOffset));
5141 __ ldr(scratch2_, 5150 __ ldr(scratch2_,
5142 CodeGenerator::ContextOperand( 5151 ContextOperand(
5143 scratch2_, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 5152 scratch2_, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
5144 __ cmp(scratch1_, scratch2_); 5153 __ cmp(scratch1_, scratch2_);
5145 __ b(ne, &false_result); 5154 __ b(ne, &false_result);
5146 5155
5147 // Set the bit in the map to indicate that it has been checked safe for 5156 // Set the bit in the map to indicate that it has been checked safe for
5148 // default valueOf and set true result. 5157 // default valueOf and set true result.
5149 __ ldr(scratch1_, FieldMemOperand(map_result_, Map::kBitField2Offset)); 5158 __ ldr(scratch1_, FieldMemOperand(map_result_, Map::kBitField2Offset));
5150 __ orr(scratch1_, 5159 __ orr(scratch1_,
5151 scratch1_, 5160 scratch1_,
5152 Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); 5161 Operand(1 << Map::kStringWrapperSafeForDefaultValueOf));
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
5818 } 5827 }
5819 5828
5820 ZoneList<Expression*>* args = node->arguments(); 5829 ZoneList<Expression*>* args = node->arguments();
5821 Comment cmnt(masm_, "[ CallRuntime"); 5830 Comment cmnt(masm_, "[ CallRuntime");
5822 Runtime::Function* function = node->function(); 5831 Runtime::Function* function = node->function();
5823 5832
5824 if (function == NULL) { 5833 if (function == NULL) {
5825 // Prepare stack for calling JS runtime function. 5834 // Prepare stack for calling JS runtime function.
5826 // Push the builtins object found in the current global object. 5835 // Push the builtins object found in the current global object.
5827 Register scratch = VirtualFrame::scratch0(); 5836 Register scratch = VirtualFrame::scratch0();
5828 __ ldr(scratch, GlobalObject()); 5837 __ ldr(scratch, GlobalObjectOperand());
5829 Register builtins = frame_->GetTOSRegister(); 5838 Register builtins = frame_->GetTOSRegister();
5830 __ ldr(builtins, FieldMemOperand(scratch, GlobalObject::kBuiltinsOffset)); 5839 __ ldr(builtins, FieldMemOperand(scratch, GlobalObject::kBuiltinsOffset));
5831 frame_->EmitPush(builtins); 5840 frame_->EmitPush(builtins);
5832 } 5841 }
5833 5842
5834 // Push the arguments ("left-to-right"). 5843 // Push the arguments ("left-to-right").
5835 int arg_count = args->length(); 5844 int arg_count = args->length();
5836 for (int i = 0; i < arg_count; i++) { 5845 for (int i = 0; i < arg_count; i++) {
5837 Load(args->at(i)); 5846 Load(args->at(i));
5838 } 5847 }
5839 5848
5840 VirtualFrame::SpilledScope spilled_scope(frame_); 5849 VirtualFrame::SpilledScope spilled_scope(frame_);
5841 5850
5842 if (function == NULL) { 5851 if (function == NULL) {
5843 // Call the JS runtime function. 5852 // Call the JS runtime function.
5844 __ mov(r2, Operand(node->name())); 5853 __ mov(r2, Operand(node->name()));
5845 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 5854 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
5846 Handle<Code> stub = ComputeCallInitialize(arg_count, in_loop); 5855 Handle<Code> stub = StubCache::ComputeCallInitialize(arg_count, in_loop);
5847 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 5856 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
5848 __ ldr(cp, frame_->Context()); 5857 __ ldr(cp, frame_->Context());
5849 frame_->EmitPush(r0); 5858 frame_->EmitPush(r0);
5850 } else { 5859 } else {
5851 // Call the C runtime function. 5860 // Call the C runtime function.
5852 frame_->CallRuntime(function, arg_count); 5861 frame_->CallRuntime(function, arg_count);
5853 frame_->EmitPush(r0); 5862 frame_->EmitPush(r0);
5854 } 5863 }
5855 ASSERT_EQ(original_height + 1, frame_->height()); 5864 ASSERT_EQ(original_height + 1, frame_->height());
5856 } 5865 }
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
7256 BinaryOpIC::GetName(runtime_operands_type_)); 7265 BinaryOpIC::GetName(runtime_operands_type_));
7257 return name_; 7266 return name_;
7258 } 7267 }
7259 7268
7260 7269
7261 #undef __ 7270 #undef __
7262 7271
7263 } } // namespace v8::internal 7272 } } // namespace v8::internal
7264 7273
7265 #endif // V8_TARGET_ARCH_ARM 7274 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/arm/disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698