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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 8638012: ARM: Implement code stub for object literal creation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Erik Corry. Created 9 years 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 271 }
272 int size = JSArray::kSize + elements_size; 272 int size = JSArray::kSize + elements_size;
273 273
274 // Load boilerplate object into r3 and check if we need to create a 274 // Load boilerplate object into r3 and check if we need to create a
275 // boilerplate. 275 // boilerplate.
276 Label slow_case; 276 Label slow_case;
277 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); 277 __ ldr(r3, MemOperand(sp, 2 * kPointerSize));
278 __ ldr(r0, MemOperand(sp, 1 * kPointerSize)); 278 __ ldr(r0, MemOperand(sp, 1 * kPointerSize));
279 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 279 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
280 __ ldr(r3, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); 280 __ ldr(r3, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize));
281 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 281 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex);
282 __ cmp(r3, ip);
283 __ b(eq, &slow_case); 282 __ b(eq, &slow_case);
284 283
285 if (FLAG_debug_code) { 284 if (FLAG_debug_code) {
286 const char* message; 285 const char* message;
287 Heap::RootListIndex expected_map_index; 286 Heap::RootListIndex expected_map_index;
288 if (mode_ == CLONE_ELEMENTS) { 287 if (mode_ == CLONE_ELEMENTS) {
289 message = "Expected (writable) fixed array"; 288 message = "Expected (writable) fixed array";
290 expected_map_index = Heap::kFixedArrayMapRootIndex; 289 expected_map_index = Heap::kFixedArrayMapRootIndex;
291 } else if (mode_ == CLONE_DOUBLE_ELEMENTS) { 290 } else if (mode_ == CLONE_DOUBLE_ELEMENTS) {
292 message = "Expected (writable) fixed double array"; 291 message = "Expected (writable) fixed double array";
293 expected_map_index = Heap::kFixedDoubleArrayMapRootIndex; 292 expected_map_index = Heap::kFixedDoubleArrayMapRootIndex;
294 } else { 293 } else {
295 ASSERT(mode_ == COPY_ON_WRITE_ELEMENTS); 294 ASSERT(mode_ == COPY_ON_WRITE_ELEMENTS);
296 message = "Expected copy-on-write fixed array"; 295 message = "Expected copy-on-write fixed array";
297 expected_map_index = Heap::kFixedCOWArrayMapRootIndex; 296 expected_map_index = Heap::kFixedCOWArrayMapRootIndex;
298 } 297 }
299 __ push(r3); 298 __ push(r3);
300 __ ldr(r3, FieldMemOperand(r3, JSArray::kElementsOffset)); 299 __ ldr(r3, FieldMemOperand(r3, JSArray::kElementsOffset));
301 __ ldr(r3, FieldMemOperand(r3, HeapObject::kMapOffset)); 300 __ ldr(r3, FieldMemOperand(r3, HeapObject::kMapOffset));
302 __ LoadRoot(ip, expected_map_index); 301 __ CompareRoot(r3, expected_map_index);
303 __ cmp(r3, ip);
304 __ Assert(eq, message); 302 __ Assert(eq, message);
305 __ pop(r3); 303 __ pop(r3);
306 } 304 }
307 305
308 // Allocate both the JS array and the elements array in one big 306 // Allocate both the JS array and the elements array in one big
309 // allocation. This avoids multiple limit checks. 307 // allocation. This avoids multiple limit checks.
310 __ AllocateInNewSpace(size, 308 __ AllocateInNewSpace(size,
311 r0, 309 r0,
312 r1, 310 r1,
313 r2, 311 r2,
(...skipping 22 matching lines...) Expand all
336 334
337 // Return and remove the on-stack parameters. 335 // Return and remove the on-stack parameters.
338 __ add(sp, sp, Operand(3 * kPointerSize)); 336 __ add(sp, sp, Operand(3 * kPointerSize));
339 __ Ret(); 337 __ Ret();
340 338
341 __ bind(&slow_case); 339 __ bind(&slow_case);
342 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); 340 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1);
343 } 341 }
344 342
345 343
344 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) {
345 // Stack layout on entry:
346 //
347 // [sp]: object literal flags.
348 // [sp + kPointerSize]: constant properties.
349 // [sp + (2 * kPointerSize)]: literal index.
350 // [sp + (3 * kPointerSize)]: literals array.
351
352 // Load boilerplate object into r3 and check if we need to create a
353 // boilerplate.
354 Label slow_case;
355 __ ldr(r3, MemOperand(sp, 3 * kPointerSize));
356 __ ldr(r0, MemOperand(sp, 2 * kPointerSize));
357 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
358 __ ldr(r3, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize));
359 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex);
360 __ b(eq, &slow_case);
361
362 // Check that the boilerplate contains only fast properties and we can
363 // statically determine the instance size.
364 int size = JSObject::kHeaderSize + length_ * kPointerSize;
365 __ ldr(r0, FieldMemOperand(r3, HeapObject::kMapOffset));
366 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceSizeOffset));
367 __ cmp(r0, Operand(size >> kPointerSizeLog2));
368 __ b(ne, &slow_case);
369
370 // Allocate the JS object and copy header together with all in-object
371 // properties from the boilerplate.
372 __ AllocateInNewSpace(size, r0, r1, r2, &slow_case, TAG_OBJECT);
373 for (int i = 0; i < size; i += kPointerSize) {
374 __ ldr(r1, FieldMemOperand(r3, i));
375 __ str(r1, FieldMemOperand(r0, i));
376 }
377
378 // Return and remove the on-stack parameters.
379 __ add(sp, sp, Operand(4 * kPointerSize));
380 __ Ret();
381
382 __ bind(&slow_case);
383 __ TailCallRuntime(Runtime::kCreateObjectLiteralShallow, 4, 1);
384 }
385
386
346 // Takes a Smi and converts to an IEEE 64 bit floating point value in two 387 // Takes a Smi and converts to an IEEE 64 bit floating point value in two
347 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and 388 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and
348 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a 389 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a
349 // scratch register. Destroys the source register. No GC occurs during this 390 // scratch register. Destroys the source register. No GC occurs during this
350 // stub so you don't have to set up the frame. 391 // stub so you don't have to set up the frame.
351 class ConvertToDoubleStub : public CodeStub { 392 class ConvertToDoubleStub : public CodeStub {
352 public: 393 public:
353 ConvertToDoubleStub(Register result_reg_1, 394 ConvertToDoubleStub(Register result_reg_1,
354 Register result_reg_2, 395 Register result_reg_2,
355 Register source_reg, 396 Register source_reg,
(...skipping 6823 matching lines...) Expand 10 before | Expand all | Expand 10 after
7179 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, 7220 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10,
7180 &slow_elements); 7221 &slow_elements);
7181 __ Ret(); 7222 __ Ret();
7182 } 7223 }
7183 7224
7184 #undef __ 7225 #undef __
7185 7226
7186 } } // namespace v8::internal 7227 } } // namespace v8::internal
7187 7228
7188 #endif // V8_TARGET_ARCH_ARM 7229 #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