| 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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 context()->Plug(eax); | 1336 context()->Plug(eax); |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 | 1339 |
| 1340 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1340 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
| 1341 Comment cmnt(masm_, "[ ObjectLiteral"); | 1341 Comment cmnt(masm_, "[ ObjectLiteral"); |
| 1342 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1342 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1343 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); | 1343 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| 1344 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1344 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
| 1345 __ push(Immediate(expr->constant_properties())); | 1345 __ push(Immediate(expr->constant_properties())); |
| 1346 __ push(Immediate(Smi::FromInt(expr->fast_elements() ? 1 : 0))); | 1346 int flags = expr->fast_elements() |
| 1347 ? ObjectLiteral::kFastElements |
| 1348 : ObjectLiteral::kNoFlags; |
| 1349 flags |= expr->has_function() |
| 1350 ? ObjectLiteral::kHasFunction |
| 1351 : ObjectLiteral::kNoFlags; |
| 1352 __ push(Immediate(Smi::FromInt(flags))); |
| 1347 if (expr->depth() > 1) { | 1353 if (expr->depth() > 1) { |
| 1348 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1354 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
| 1349 } else { | 1355 } else { |
| 1350 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1356 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
| 1351 } | 1357 } |
| 1352 | 1358 |
| 1353 // If result_saved is true the result is on top of the stack. If | 1359 // If result_saved is true the result is on top of the stack. If |
| 1354 // result_saved is false the result is in eax. | 1360 // result_saved is false the result is in eax. |
| 1355 bool result_saved = false; | 1361 bool result_saved = false; |
| 1356 | 1362 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 __ push(Immediate(property->kind() == ObjectLiteral::Property::SETTER ? | 1414 __ push(Immediate(property->kind() == ObjectLiteral::Property::SETTER ? |
| 1409 Smi::FromInt(1) : | 1415 Smi::FromInt(1) : |
| 1410 Smi::FromInt(0))); | 1416 Smi::FromInt(0))); |
| 1411 VisitForStackValue(value); | 1417 VisitForStackValue(value); |
| 1412 __ CallRuntime(Runtime::kDefineAccessor, 4); | 1418 __ CallRuntime(Runtime::kDefineAccessor, 4); |
| 1413 break; | 1419 break; |
| 1414 default: UNREACHABLE(); | 1420 default: UNREACHABLE(); |
| 1415 } | 1421 } |
| 1416 } | 1422 } |
| 1417 | 1423 |
| 1424 if (expr->has_function()) { |
| 1425 ASSERT(result_saved); |
| 1426 __ push(Operand(esp, 0)); |
| 1427 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 1428 } |
| 1429 |
| 1418 if (result_saved) { | 1430 if (result_saved) { |
| 1419 context()->PlugTOS(); | 1431 context()->PlugTOS(); |
| 1420 } else { | 1432 } else { |
| 1421 context()->Plug(eax); | 1433 context()->Plug(eax); |
| 1422 } | 1434 } |
| 1423 } | 1435 } |
| 1424 | 1436 |
| 1425 | 1437 |
| 1426 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1438 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
| 1427 Comment cmnt(masm_, "[ ArrayLiteral"); | 1439 Comment cmnt(masm_, "[ ArrayLiteral"); |
| (...skipping 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4278 // And return. | 4290 // And return. |
| 4279 __ ret(0); | 4291 __ ret(0); |
| 4280 } | 4292 } |
| 4281 | 4293 |
| 4282 | 4294 |
| 4283 #undef __ | 4295 #undef __ |
| 4284 | 4296 |
| 4285 } } // namespace v8::internal | 4297 } } // namespace v8::internal |
| 4286 | 4298 |
| 4287 #endif // V8_TARGET_ARCH_IA32 | 4299 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |