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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 context()->Plug(r0); | 1226 context()->Plug(r0); |
1227 } | 1227 } |
1228 | 1228 |
1229 | 1229 |
1230 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1230 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1231 Comment cmnt(masm_, "[ ObjectLiteral"); | 1231 Comment cmnt(masm_, "[ ObjectLiteral"); |
1232 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1232 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1233 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1233 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
1234 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1234 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
1235 __ mov(r1, Operand(expr->constant_properties())); | 1235 __ mov(r1, Operand(expr->constant_properties())); |
1236 __ mov(r0, Operand(Smi::FromInt(expr->fast_elements() ? 1 : 0))); | 1236 int flags = expr->fast_elements() |
| 1237 ? ObjectLiteral::kFastElements |
| 1238 : ObjectLiteral::kNoFlags; |
| 1239 flags |= expr->has_function() |
| 1240 ? ObjectLiteral::kHasFunction |
| 1241 : ObjectLiteral::kNoFlags; |
| 1242 __ mov(r0, Operand(Smi::FromInt(flags))); |
1237 __ Push(r3, r2, r1, r0); | 1243 __ Push(r3, r2, r1, r0); |
1238 if (expr->depth() > 1) { | 1244 if (expr->depth() > 1) { |
1239 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1245 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1240 } else { | 1246 } else { |
1241 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1247 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1242 } | 1248 } |
1243 | 1249 |
1244 // If result_saved is true the result is on top of the stack. If | 1250 // If result_saved is true the result is on top of the stack. If |
1245 // result_saved is false the result is in r0. | 1251 // result_saved is false the result is in r0. |
1246 bool result_saved = false; | 1252 bool result_saved = false; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ? | 1308 __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ? |
1303 Smi::FromInt(1) : | 1309 Smi::FromInt(1) : |
1304 Smi::FromInt(0))); | 1310 Smi::FromInt(0))); |
1305 __ push(r1); | 1311 __ push(r1); |
1306 VisitForStackValue(value); | 1312 VisitForStackValue(value); |
1307 __ CallRuntime(Runtime::kDefineAccessor, 4); | 1313 __ CallRuntime(Runtime::kDefineAccessor, 4); |
1308 break; | 1314 break; |
1309 } | 1315 } |
1310 } | 1316 } |
1311 | 1317 |
| 1318 if (expr->has_function()) { |
| 1319 ASSERT(result_saved); |
| 1320 __ ldr(r0, MemOperand(sp)); |
| 1321 __ push(r0); |
| 1322 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 1323 } |
| 1324 |
1312 if (result_saved) { | 1325 if (result_saved) { |
1313 context()->PlugTOS(); | 1326 context()->PlugTOS(); |
1314 } else { | 1327 } else { |
1315 context()->Plug(r0); | 1328 context()->Plug(r0); |
1316 } | 1329 } |
1317 } | 1330 } |
1318 | 1331 |
1319 | 1332 |
1320 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1333 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
1321 Comment cmnt(masm_, "[ ArrayLiteral"); | 1334 Comment cmnt(masm_, "[ ArrayLiteral"); |
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3618 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3631 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
3619 __ add(pc, r1, Operand(masm_->CodeObject())); | 3632 __ add(pc, r1, Operand(masm_->CodeObject())); |
3620 } | 3633 } |
3621 | 3634 |
3622 | 3635 |
3623 #undef __ | 3636 #undef __ |
3624 | 3637 |
3625 } } // namespace v8::internal | 3638 } } // namespace v8::internal |
3626 | 3639 |
3627 #endif // V8_TARGET_ARCH_ARM | 3640 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |