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

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 8359014: Create stub and runtime function for ia32 full-codegen array literal element initialization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | « src/ia32/code-stubs-ia32.cc ('k') | src/runtime.h » ('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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 if (!result_saved) { 1498 if (!result_saved) {
1499 __ push(eax); 1499 __ push(eax);
1500 result_saved = true; 1500 result_saved = true;
1501 increment_stack_height(); 1501 increment_stack_height();
1502 } 1502 }
1503 VisitForAccumulatorValue(subexpr); 1503 VisitForAccumulatorValue(subexpr);
1504 1504
1505 // Store the subexpression value in the array's elements. 1505 // Store the subexpression value in the array's elements.
1506 __ mov(ebx, Operand(esp, 0)); // Copy of array literal. 1506 __ mov(ebx, Operand(esp, 0)); // Copy of array literal.
1507 __ mov(edi, FieldOperand(ebx, JSObject::kMapOffset)); 1507 __ mov(edi, FieldOperand(ebx, JSObject::kMapOffset));
1508 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset));
1509 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1510
1511 Label element_done;
1512 Label double_elements;
1513 Label smi_element;
1514 Label slow_elements;
1515 Label fast_elements;
1516 __ CheckFastElements(edi, &double_elements);
1517
1518 // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS
1519 __ JumpIfSmi(result_register(), &smi_element);
1520 __ CheckFastSmiOnlyElements(edi, &fast_elements, Label::kNear);
1521
1522 // Store into the array literal requires a elements transition. Call into
1523 // the runtime.
1524 __ bind(&slow_elements);
1525 __ push(Operand(esp, 0)); // Copy of array literal.
1526 __ push(Immediate(Smi::FromInt(i)));
1527 __ push(result_register());
1528 __ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
1529 __ push(Immediate(Smi::FromInt(strict_mode_flag()))); // Strict mode.
1530 __ CallRuntime(Runtime::kSetProperty, 5);
1531 __ jmp(&element_done);
1532
1533 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS.
1534 __ bind(&double_elements);
1535 __ mov(ecx, Immediate(Smi::FromInt(i))); 1508 __ mov(ecx, Immediate(Smi::FromInt(i)));
1536 __ StoreNumberToDoubleElements(result_register(), 1509 __ mov(edx, Immediate(Smi::FromInt(expr->literal_index())));
1537 ebx, 1510 StoreArrayLiteralElementStub stub;
1538 ecx, 1511 __ CallStub(&stub);
1539 edx,
1540 xmm0,
1541 &slow_elements,
1542 false);
1543 __ jmp(&element_done);
1544
1545 // Array literal has ElementsKind of FAST_ELEMENTS and value is an object.
1546 __ bind(&fast_elements);
1547 __ mov(FieldOperand(ebx, offset), result_register());
1548 // Update the write barrier for the array store.
1549 __ RecordWriteField(ebx, offset, result_register(), ecx,
1550 kDontSaveFPRegs,
1551 EMIT_REMEMBERED_SET,
1552 OMIT_SMI_CHECK);
1553 __ jmp(&element_done);
1554
1555 // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or
1556 // FAST_ELEMENTS, and value is Smi.
1557 __ bind(&smi_element);
1558 __ mov(FieldOperand(ebx, offset), result_register());
1559 // Fall through
1560
1561 __ bind(&element_done);
1562 1512
1563 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); 1513 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS);
1564 } 1514 }
1565 1515
1566 if (result_saved) { 1516 if (result_saved) {
1567 context()->PlugTOS(); 1517 context()->PlugTOS();
1568 } else { 1518 } else {
1569 context()->Plug(eax); 1519 context()->Plug(eax);
1570 } 1520 }
1571 } 1521 }
(...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after
4386 *context_length = 0; 4336 *context_length = 0;
4387 return previous_; 4337 return previous_;
4388 } 4338 }
4389 4339
4390 4340
4391 #undef __ 4341 #undef __
4392 4342
4393 } } // namespace v8::internal 4343 } } // namespace v8::internal
4394 4344
4395 #endif // V8_TARGET_ARCH_IA32 4345 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698