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

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

Issue 8747011: MIPS: Implement code stub for object literal creation. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 // Return and remove the on-stack parameters. 337 // Return and remove the on-stack parameters.
338 __ Addu(sp, sp, Operand(3 * kPointerSize)); 338 __ Addu(sp, sp, Operand(3 * kPointerSize));
339 __ Ret(); 339 __ Ret();
340 340
341 __ bind(&slow_case); 341 __ bind(&slow_case);
342 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); 342 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1);
343 } 343 }
344 344
345 345
346 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) {
347 // Stack layout on entry:
348 //
349 // [sp]: object literal flags.
350 // [sp + kPointerSize]: constant properties.
351 // [sp + (2 * kPointerSize)]: literal index.
352 // [sp + (3 * kPointerSize)]: literals array.
353
354 // Load boilerplate object into a3 and check if we need to create a
355 // boilerplate.
356 Label slow_case;
357 __ lw(a3, MemOperand(sp, 3 * kPointerSize));
358 __ lw(a0, MemOperand(sp, 2 * kPointerSize));
359 __ Addu(a3, a3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
360 __ sll(t0, a0, kPointerSizeLog2 - kSmiTagSize);
361 __ Addu(a3, t0, a3);
362 __ lw(a3, MemOperand(a3));
363 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
364 __ Branch(&slow_case, eq, a3, Operand(t0));
365
366 // Check that the boilerplate contains only fast properties and we can
367 // statically determine the instance size.
368 int size = JSObject::kHeaderSize + length_ * kPointerSize;
369 __ lw(a0, FieldMemOperand(a3, HeapObject::kMapOffset));
370 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceSizeOffset));
371 __ Branch(&slow_case, ne, a0, Operand(size >> kPointerSizeLog2));
372
373 // Allocate the JS object and copy header together with all in-object
374 // properties from the boilerplate.
375 __ AllocateInNewSpace(size, a0, a1, a2, &slow_case, TAG_OBJECT);
376 for (int i = 0; i < size; i += kPointerSize) {
377 __ lw(a1, FieldMemOperand(a3, i));
378 __ sw(a1, FieldMemOperand(a0, i));
379 }
380
381 // Return and remove the on-stack parameters.
382 __ Drop(4);
383 __ Ret(USE_DELAY_SLOT);
384 __ mov(v0, a0);
385
386 __ bind(&slow_case);
387 __ TailCallRuntime(Runtime::kCreateObjectLiteralShallow, 4, 1);
388 }
389
390
346 // Takes a Smi and converts to an IEEE 64 bit floating point value in two 391 // 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 392 // 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 393 // 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 394 // scratch register. Destroys the source register. No GC occurs during this
350 // stub so you don't have to set up the frame. 395 // stub so you don't have to set up the frame.
351 class ConvertToDoubleStub : public CodeStub { 396 class ConvertToDoubleStub : public CodeStub {
352 public: 397 public:
353 ConvertToDoubleStub(Register result_reg_1, 398 ConvertToDoubleStub(Register result_reg_1,
354 Register result_reg_2, 399 Register result_reg_2,
355 Register source_reg, 400 Register source_reg,
(...skipping 7105 matching lines...) Expand 10 before | Expand all | Expand 10 after
7461 &slow_elements); 7506 &slow_elements);
7462 __ Ret(); 7507 __ Ret();
7463 } 7508 }
7464 7509
7465 7510
7466 #undef __ 7511 #undef __
7467 7512
7468 } } // namespace v8::internal 7513 } } // namespace v8::internal
7469 7514
7470 #endif // V8_TARGET_ARCH_MIPS 7515 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698