OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 __ push(Immediate(isolate()->factory()->null_value())); | 1519 __ push(Immediate(isolate()->factory()->null_value())); |
1520 } else { | 1520 } else { |
1521 VisitForStackValue(expression); | 1521 VisitForStackValue(expression); |
1522 } | 1522 } |
1523 } | 1523 } |
1524 | 1524 |
1525 | 1525 |
1526 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1526 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1527 Comment cmnt(masm_, "[ ObjectLiteral"); | 1527 Comment cmnt(masm_, "[ ObjectLiteral"); |
1528 Handle<FixedArray> constant_properties = expr->constant_properties(); | 1528 Handle<FixedArray> constant_properties = expr->constant_properties(); |
1529 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
1530 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); | |
1531 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | |
1532 __ push(Immediate(constant_properties)); | |
1533 int flags = expr->fast_elements() | 1529 int flags = expr->fast_elements() |
1534 ? ObjectLiteral::kFastElements | 1530 ? ObjectLiteral::kFastElements |
1535 : ObjectLiteral::kNoFlags; | 1531 : ObjectLiteral::kNoFlags; |
1536 flags |= expr->has_function() | 1532 flags |= expr->has_function() |
1537 ? ObjectLiteral::kHasFunction | 1533 ? ObjectLiteral::kHasFunction |
1538 : ObjectLiteral::kNoFlags; | 1534 : ObjectLiteral::kNoFlags; |
1539 __ push(Immediate(Smi::FromInt(flags))); | |
1540 int properties_count = constant_properties->length() / 2; | 1535 int properties_count = constant_properties->length() / 2; |
1541 if (expr->depth() > 1) { | 1536 if (expr->depth() > 1) { |
| 1537 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1538 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| 1539 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
| 1540 __ push(Immediate(constant_properties)); |
| 1541 __ push(Immediate(Smi::FromInt(flags))); |
1542 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1542 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1543 } else if (flags != ObjectLiteral::kFastElements || | 1543 } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements || |
1544 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 1544 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1545 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1546 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| 1547 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
| 1548 __ push(Immediate(constant_properties)); |
| 1549 __ push(Immediate(Smi::FromInt(flags))); |
1545 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1550 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1546 } else { | 1551 } else { |
| 1552 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1553 __ mov(eax, FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| 1554 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); |
| 1555 __ mov(ecx, Immediate(constant_properties)); |
| 1556 __ mov(edx, Immediate(Smi::FromInt(flags))); |
1547 FastCloneShallowObjectStub stub(properties_count); | 1557 FastCloneShallowObjectStub stub(properties_count); |
1548 __ CallStub(&stub); | 1558 __ CallStub(&stub); |
1549 } | 1559 } |
1550 | 1560 |
1551 // If result_saved is true the result is on top of the stack. If | 1561 // If result_saved is true the result is on top of the stack. If |
1552 // result_saved is false the result is in eax. | 1562 // result_saved is false the result is in eax. |
1553 bool result_saved = false; | 1563 bool result_saved = false; |
1554 | 1564 |
1555 // Mark all computed expressions that are bound to a key that | 1565 // Mark all computed expressions that are bound to a key that |
1556 // is shadowed by a later occurrence of the same key. For the | 1566 // is shadowed by a later occurrence of the same key. For the |
(...skipping 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4526 *stack_depth = 0; | 4536 *stack_depth = 0; |
4527 *context_length = 0; | 4537 *context_length = 0; |
4528 return previous_; | 4538 return previous_; |
4529 } | 4539 } |
4530 | 4540 |
4531 #undef __ | 4541 #undef __ |
4532 | 4542 |
4533 } } // namespace v8::internal | 4543 } } // namespace v8::internal |
4534 | 4544 |
4535 #endif // V8_TARGET_ARCH_IA32 | 4545 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |