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

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

Issue 546031: Fix bug in the ARM port of FastNewContextStub. Load the function from... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 11 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 4437 matching lines...) Expand 10 before | Expand all | Expand 10 after
4448 __ push(r3); 4448 __ push(r3);
4449 __ TailCallRuntime(ExternalReference(Runtime::kNewClosure), 2, 1); 4449 __ TailCallRuntime(ExternalReference(Runtime::kNewClosure), 2, 1);
4450 } 4450 }
4451 4451
4452 4452
4453 void FastNewContextStub::Generate(MacroAssembler* masm) { 4453 void FastNewContextStub::Generate(MacroAssembler* masm) {
4454 // Try to allocate the context in new space. 4454 // Try to allocate the context in new space.
4455 Label gc; 4455 Label gc;
4456 int length = slots_ + Context::MIN_CONTEXT_SLOTS; 4456 int length = slots_ + Context::MIN_CONTEXT_SLOTS;
4457 4457
4458 // Pop the function from the stack.
4459 __ pop(r3);
4460
4461 // Attempt to allocate the context in new space. 4458 // Attempt to allocate the context in new space.
4462 __ AllocateInNewSpace(length + (FixedArray::kHeaderSize / kPointerSize), 4459 __ AllocateInNewSpace(length + (FixedArray::kHeaderSize / kPointerSize),
4463 r0, 4460 r0,
4464 r1, 4461 r1,
4465 r2, 4462 r2,
4466 &gc, 4463 &gc,
4467 TAG_OBJECT); 4464 TAG_OBJECT);
4468 4465
4466 // Load the function from the stack.
4467 __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
4468
4469 // Setup the object header. 4469 // Setup the object header.
4470 __ LoadRoot(r2, Heap::kContextMapRootIndex); 4470 __ LoadRoot(r2, Heap::kContextMapRootIndex);
4471 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); 4471 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
4472 __ mov(r2, Operand(length)); 4472 __ mov(r2, Operand(length));
4473 __ str(r2, FieldMemOperand(r0, Array::kLengthOffset)); 4473 __ str(r2, FieldMemOperand(r0, Array::kLengthOffset));
4474 4474
4475 // Setup the fixed slots. 4475 // Setup the fixed slots.
4476 __ mov(r1, Operand(Smi::FromInt(0))); 4476 __ mov(r1, Operand(Smi::FromInt(0)));
4477 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); 4477 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX)));
4478 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); 4478 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX)));
4479 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); 4479 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX)));
4480 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); 4480 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX)));
4481 4481
4482 // Copy the global object from the surrounding context. 4482 // Copy the global object from the surrounding context.
4483 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); 4483 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
4484 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::GLOBAL_INDEX))); 4484 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::GLOBAL_INDEX)));
4485 4485
4486 // Initialize the rest of the slots to undefined. 4486 // Initialize the rest of the slots to undefined.
4487 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 4487 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
4488 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { 4488 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) {
4489 __ str(r1, MemOperand(r0, Context::SlotOffset(i))); 4489 __ str(r1, MemOperand(r0, Context::SlotOffset(i)));
4490 } 4490 }
4491 4491
4492 // Return. The on-stack parameter has already been popped. 4492 // Remove the on-stack argument and return.
4493 __ mov(cp, r0); 4493 __ mov(cp, r0);
4494 __ pop();
4494 __ Ret(); 4495 __ Ret();
4495 4496
4496 // Need to collect. Call into runtime system. 4497 // Need to collect. Call into runtime system.
4497 __ bind(&gc); 4498 __ bind(&gc);
4498 __ TailCallRuntime(ExternalReference(Runtime::kNewContext), 1, 1); 4499 __ TailCallRuntime(ExternalReference(Runtime::kNewContext), 1, 1);
4499 } 4500 }
4500 4501
4501 4502
4502 // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz 4503 // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz
4503 // instruction. On pre-ARM5 hardware this routine gives the wrong answer for 0 4504 // instruction. On pre-ARM5 hardware this routine gives the wrong answer for 0
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after
6676 ASSERT((static_cast<unsigned>(cc_) >> 26) < (1 << 16)); 6677 ASSERT((static_cast<unsigned>(cc_) >> 26) < (1 << 16));
6677 int nnn_value = (never_nan_nan_ ? 2 : 0); 6678 int nnn_value = (never_nan_nan_ ? 2 : 0);
6678 if (cc_ != eq) nnn_value = 0; // Avoid duplicate stubs. 6679 if (cc_ != eq) nnn_value = 0; // Avoid duplicate stubs.
6679 return (static_cast<unsigned>(cc_) >> 26) | nnn_value | (strict_ ? 1 : 0); 6680 return (static_cast<unsigned>(cc_) >> 26) | nnn_value | (strict_ ? 1 : 0);
6680 } 6681 }
6681 6682
6682 6683
6683 #undef __ 6684 #undef __
6684 6685
6685 } } // namespace v8::internal 6686 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698