OLD | NEW |
---|---|
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 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1479 ASSERT_EQ(2, constant_elements->length()); | 1479 ASSERT_EQ(2, constant_elements->length()); |
1480 ElementsKind constant_elements_kind = | 1480 ElementsKind constant_elements_kind = |
1481 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1481 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
1482 Handle<FixedArrayBase> constant_elements_values( | 1482 Handle<FixedArrayBase> constant_elements_values( |
1483 FixedArrayBase::cast(constant_elements->get(1))); | 1483 FixedArrayBase::cast(constant_elements->get(1))); |
1484 | 1484 |
1485 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1485 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1486 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); | 1486 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); |
1487 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1487 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
1488 __ push(Immediate(constant_elements)); | 1488 __ push(Immediate(constant_elements)); |
1489 if (constant_elements_values->map() == | 1489 if (expr->depth() > 1) { |
1490 isolate()->heap()->fixed_cow_array_map()) { | |
1491 ASSERT(expr->depth() == 1); | |
1492 FastCloneShallowArrayStub stub( | |
1493 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length); | |
1494 __ CallStub(&stub); | |
1495 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); | |
Jakob Kummerow
2011/11/17 12:31:36
This line got lost in the refactoring. Care to put
danno
2011/11/17 13:51:23
Done.
| |
1496 } else if (expr->depth() > 1) { | |
1497 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1490 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
1498 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1491 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
1499 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1492 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
1500 } else { | 1493 } else { |
1501 ASSERT(constant_elements_kind == FAST_ELEMENTS || | 1494 ASSERT(constant_elements_kind == FAST_ELEMENTS || |
1502 constant_elements_kind == FAST_SMI_ONLY_ELEMENTS || | 1495 constant_elements_kind == FAST_SMI_ONLY_ELEMENTS || |
1503 FLAG_smi_only_arrays); | 1496 FLAG_smi_only_arrays); |
1504 FastCloneShallowArrayStub::Mode mode = | 1497 FastCloneShallowArrayStub stub( |
1505 constant_elements_kind == FAST_DOUBLE_ELEMENTS | 1498 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS, length); |
1506 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | |
1507 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | |
1508 FastCloneShallowArrayStub stub(mode, length); | |
1509 __ CallStub(&stub); | 1499 __ CallStub(&stub); |
1510 } | 1500 } |
1511 | 1501 |
1512 bool result_saved = false; // Is the result saved to the stack? | 1502 bool result_saved = false; // Is the result saved to the stack? |
1513 | 1503 |
1514 // Emit code to evaluate all the non-constant subexpressions and to store | 1504 // Emit code to evaluate all the non-constant subexpressions and to store |
1515 // them into the newly cloned array. | 1505 // them into the newly cloned array. |
1516 for (int i = 0; i < length; i++) { | 1506 for (int i = 0; i < length; i++) { |
1517 Expression* subexpr = subexprs->at(i); | 1507 Expression* subexpr = subexprs->at(i); |
1518 // If the subexpression is a literal or a simple materialized literal it | 1508 // If the subexpression is a literal or a simple materialized literal it |
(...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4343 *context_length = 0; | 4333 *context_length = 0; |
4344 return previous_; | 4334 return previous_; |
4345 } | 4335 } |
4346 | 4336 |
4347 | 4337 |
4348 #undef __ | 4338 #undef __ |
4349 | 4339 |
4350 } } // namespace v8::internal | 4340 } } // namespace v8::internal |
4351 | 4341 |
4352 #endif // V8_TARGET_ARCH_IA32 | 4342 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |