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

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

Issue 2047002: Add a flag to the ARM version of new space allocation in generated code... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 7 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
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 4396 matching lines...) Expand 10 before | Expand all | Expand 10 after
4407 // Smi-tagging is equivalent to multiplying by 2. 4407 // Smi-tagging is equivalent to multiplying by 2.
4408 // Allocate RegExpResult followed by FixedArray with size in ebx. 4408 // Allocate RegExpResult followed by FixedArray with size in ebx.
4409 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] 4409 // JSArray: [Map][empty properties][Elements][Length-smi][index][input]
4410 // Elements: [Map][Length][..elements..] 4410 // Elements: [Map][Length][..elements..]
4411 // Size of JSArray with two in-object properties and the header of a 4411 // Size of JSArray with two in-object properties and the header of a
4412 // FixedArray. 4412 // FixedArray.
4413 int objects_size = 4413 int objects_size =
4414 (JSRegExpResult::kSize + FixedArray::kHeaderSize) / kPointerSize; 4414 (JSRegExpResult::kSize + FixedArray::kHeaderSize) / kPointerSize;
4415 __ mov(r5, Operand(r1, LSR, kSmiTagSize + kSmiShiftSize)); 4415 __ mov(r5, Operand(r1, LSR, kSmiTagSize + kSmiShiftSize));
4416 __ add(r2, r5, Operand(objects_size)); 4416 __ add(r2, r5, Operand(objects_size));
4417 __ AllocateInNewSpace(r2, // In: Size, in words. 4417 __ AllocateInNewSpace(
4418 r0, // Out: Start of allocation (tagged). 4418 r2, // In: Size, in words.
4419 r3, // Scratch register. 4419 r0, // Out: Start of allocation (tagged).
4420 r4, // Scratch register. 4420 r3, // Scratch register.
4421 &slowcase, 4421 r4, // Scratch register.
4422 TAG_OBJECT); 4422 &slowcase,
4423 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS));
4423 // r0: Start of allocated area, object-tagged. 4424 // r0: Start of allocated area, object-tagged.
4424 // r1: Number of elements in array, as smi. 4425 // r1: Number of elements in array, as smi.
4425 // r5: Number of elements, untagged. 4426 // r5: Number of elements, untagged.
4426 4427
4427 // Set JSArray map to global.regexp_result_map(). 4428 // Set JSArray map to global.regexp_result_map().
4428 // Set empty properties FixedArray. 4429 // Set empty properties FixedArray.
4429 // Set elements to point to FixedArray allocated right after the JSArray. 4430 // Set elements to point to FixedArray allocated right after the JSArray.
4430 // Interleave operations for better latency. 4431 // Interleave operations for better latency.
4431 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_INDEX)); 4432 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_INDEX));
4432 __ add(r3, r0, Operand(JSRegExpResult::kSize)); 4433 __ add(r3, r0, Operand(JSRegExpResult::kSize));
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
5860 5861
5861 void FastNewClosureStub::Generate(MacroAssembler* masm) { 5862 void FastNewClosureStub::Generate(MacroAssembler* masm) {
5862 // Create a new closure from the given function info in new 5863 // Create a new closure from the given function info in new
5863 // space. Set the context to the current context in cp. 5864 // space. Set the context to the current context in cp.
5864 Label gc; 5865 Label gc;
5865 5866
5866 // Pop the function info from the stack. 5867 // Pop the function info from the stack.
5867 __ pop(r3); 5868 __ pop(r3);
5868 5869
5869 // Attempt to allocate new JSFunction in new space. 5870 // Attempt to allocate new JSFunction in new space.
5870 __ AllocateInNewSpace(JSFunction::kSize / kPointerSize, 5871 __ AllocateInNewSpace(JSFunction::kSize,
5871 r0, 5872 r0,
5872 r1, 5873 r1,
5873 r2, 5874 r2,
5874 &gc, 5875 &gc,
5875 TAG_OBJECT); 5876 TAG_OBJECT);
5876 5877
5877 // Compute the function map in the current global context and set that 5878 // Compute the function map in the current global context and set that
5878 // as the map of the allocated object. 5879 // as the map of the allocated object.
5879 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); 5880 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
5880 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset)); 5881 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset));
(...skipping 20 matching lines...) Expand all
5901 __ TailCallRuntime(Runtime::kNewClosure, 2, 1); 5902 __ TailCallRuntime(Runtime::kNewClosure, 2, 1);
5902 } 5903 }
5903 5904
5904 5905
5905 void FastNewContextStub::Generate(MacroAssembler* masm) { 5906 void FastNewContextStub::Generate(MacroAssembler* masm) {
5906 // Try to allocate the context in new space. 5907 // Try to allocate the context in new space.
5907 Label gc; 5908 Label gc;
5908 int length = slots_ + Context::MIN_CONTEXT_SLOTS; 5909 int length = slots_ + Context::MIN_CONTEXT_SLOTS;
5909 5910
5910 // Attempt to allocate the context in new space. 5911 // Attempt to allocate the context in new space.
5911 __ AllocateInNewSpace(length + (FixedArray::kHeaderSize / kPointerSize), 5912 __ AllocateInNewSpace(
5912 r0, 5913 length + (FixedArray::kHeaderSize / kPointerSize),
Vyacheslav Egorov (Chromium) 2010/05/07 13:18:26 FixedArray::SizeFor(length) and allocation in byte
5913 r1, 5914 r0,
5914 r2, 5915 r1,
5915 &gc, 5916 r2,
5916 TAG_OBJECT); 5917 &gc,
5918 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS));
5917 5919
5918 // Load the function from the stack. 5920 // Load the function from the stack.
5919 __ ldr(r3, MemOperand(sp, 0)); 5921 __ ldr(r3, MemOperand(sp, 0));
5920 5922
5921 // Setup the object header. 5923 // Setup the object header.
5922 __ LoadRoot(r2, Heap::kContextMapRootIndex); 5924 __ LoadRoot(r2, Heap::kContextMapRootIndex);
5923 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); 5925 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
5924 __ mov(r2, Operand(length)); 5926 __ mov(r2, Operand(length));
5925 __ str(r2, FieldMemOperand(r0, Array::kLengthOffset)); 5927 __ str(r2, FieldMemOperand(r0, Array::kLengthOffset));
5926 5928
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
5969 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); 5971 __ ldr(r3, MemOperand(sp, 2 * kPointerSize));
5970 __ ldr(r0, MemOperand(sp, 1 * kPointerSize)); 5972 __ ldr(r0, MemOperand(sp, 1 * kPointerSize));
5971 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 5973 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
5972 __ ldr(r3, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); 5974 __ ldr(r3, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize));
5973 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 5975 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
5974 __ cmp(r3, ip); 5976 __ cmp(r3, ip);
5975 __ b(eq, &slow_case); 5977 __ b(eq, &slow_case);
5976 5978
5977 // Allocate both the JS array and the elements array in one big 5979 // Allocate both the JS array and the elements array in one big
5978 // allocation. This avoids multiple limit checks. 5980 // allocation. This avoids multiple limit checks.
5979 __ AllocateInNewSpace(size / kPointerSize, 5981 __ AllocateInNewSpace(size,
5980 r0, 5982 r0,
5981 r1, 5983 r1,
5982 r2, 5984 r2,
5983 &slow_case, 5985 &slow_case,
5984 TAG_OBJECT); 5986 TAG_OBJECT);
5985 5987
5986 // Copy the JS array part. 5988 // Copy the JS array part.
5987 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { 5989 for (int i = 0; i < JSArray::kSize; i += kPointerSize) {
5988 if ((i != JSArray::kElementsOffset) || (length_ == 0)) { 5990 if ((i != JSArray::kElementsOffset) || (length_ == 0)) {
5989 __ ldr(r1, FieldMemOperand(r3, i)); 5991 __ ldr(r1, FieldMemOperand(r3, i));
(...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after
8399 8401
8400 // Patch the arguments.length and the parameters pointer. 8402 // Patch the arguments.length and the parameters pointer.
8401 __ bind(&adaptor_frame); 8403 __ bind(&adaptor_frame);
8402 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); 8404 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset));
8403 __ str(r1, MemOperand(sp, 0)); 8405 __ str(r1, MemOperand(sp, 0));
8404 __ add(r3, r2, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); 8406 __ add(r3, r2, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize));
8405 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); 8407 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset));
8406 __ str(r3, MemOperand(sp, 1 * kPointerSize)); 8408 __ str(r3, MemOperand(sp, 1 * kPointerSize));
8407 8409
8408 // Try the new space allocation. Start out with computing the size 8410 // Try the new space allocation. Start out with computing the size
8409 // of the arguments object and the elements array (in words, not 8411 // of the arguments object and the elements array in words.
8410 // bytes because AllocateInNewSpace expects words).
8411 Label add_arguments_object; 8412 Label add_arguments_object;
8412 __ bind(&try_allocate); 8413 __ bind(&try_allocate);
8413 __ cmp(r1, Operand(0)); 8414 __ cmp(r1, Operand(0));
8414 __ b(eq, &add_arguments_object); 8415 __ b(eq, &add_arguments_object);
8415 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); 8416 __ mov(r1, Operand(r1, LSR, kSmiTagSize));
8416 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); 8417 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize));
8417 __ bind(&add_arguments_object); 8418 __ bind(&add_arguments_object);
8418 __ add(r1, r1, Operand(Heap::kArgumentsObjectSize / kPointerSize)); 8419 __ add(r1, r1, Operand(Heap::kArgumentsObjectSize / kPointerSize));
8419 8420
8420 // Do the allocation of both objects in one go. 8421 // Do the allocation of both objects in one go.
8421 __ AllocateInNewSpace(r1, r0, r2, r3, &runtime, TAG_OBJECT); 8422 __ AllocateInNewSpace(
8423 r1,
8424 r0,
8425 r2,
8426 r3,
8427 &runtime,
8428 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS));
8422 8429
8423 // Get the arguments boilerplate from the current (global) context. 8430 // Get the arguments boilerplate from the current (global) context.
8424 int offset = Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX); 8431 int offset = Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX);
8425 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); 8432 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
8426 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); 8433 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset));
8427 __ ldr(r4, MemOperand(r4, offset)); 8434 __ ldr(r4, MemOperand(r4, offset));
8428 8435
8429 // Copy the JS object part. 8436 // Copy the JS object part.
8430 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { 8437 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) {
8431 __ ldr(r3, FieldMemOperand(r4, i)); 8438 __ ldr(r3, FieldMemOperand(r4, i));
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
9962 9969
9963 // Just jump to runtime to add the two strings. 9970 // Just jump to runtime to add the two strings.
9964 __ bind(&string_add_runtime); 9971 __ bind(&string_add_runtime);
9965 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 9972 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
9966 } 9973 }
9967 9974
9968 9975
9969 #undef __ 9976 #undef __
9970 9977
9971 } } // namespace v8::internal 9978 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698