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

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

Issue 6240012: Optimize calls to object literal properties that are initialized with a funct... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: rebased and fixed lintos Created 9 years, 9 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 | « no previous file | src/arm/lithium-arm.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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 context()->Plug(r0); 1390 context()->Plug(r0);
1391 } 1391 }
1392 1392
1393 1393
1394 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1394 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1395 Comment cmnt(masm_, "[ ObjectLiteral"); 1395 Comment cmnt(masm_, "[ ObjectLiteral");
1396 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1396 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1397 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); 1397 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
1398 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); 1398 __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
1399 __ mov(r1, Operand(expr->constant_properties())); 1399 __ mov(r1, Operand(expr->constant_properties()));
1400 __ mov(r0, Operand(Smi::FromInt(expr->fast_elements() ? 1 : 0))); 1400 int flags = expr->fast_elements()
1401 ? ObjectLiteral::kFastElements
1402 : ObjectLiteral::kNoFlags;
1403 flags |= expr->has_function()
1404 ? ObjectLiteral::kHasFunction
1405 : ObjectLiteral::kNoFlags;
1406 __ mov(r0, Operand(Smi::FromInt(flags)));
1401 __ Push(r3, r2, r1, r0); 1407 __ Push(r3, r2, r1, r0);
1402 if (expr->depth() > 1) { 1408 if (expr->depth() > 1) {
1403 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1409 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1404 } else { 1410 } else {
1405 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); 1411 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
1406 } 1412 }
1407 1413
1408 // If result_saved is true the result is on top of the stack. If 1414 // If result_saved is true the result is on top of the stack. If
1409 // result_saved is false the result is in r0. 1415 // result_saved is false the result is in r0.
1410 bool result_saved = false; 1416 bool result_saved = false;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ? 1475 __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ?
1470 Smi::FromInt(1) : 1476 Smi::FromInt(1) :
1471 Smi::FromInt(0))); 1477 Smi::FromInt(0)));
1472 __ push(r1); 1478 __ push(r1);
1473 VisitForStackValue(value); 1479 VisitForStackValue(value);
1474 __ CallRuntime(Runtime::kDefineAccessor, 4); 1480 __ CallRuntime(Runtime::kDefineAccessor, 4);
1475 break; 1481 break;
1476 } 1482 }
1477 } 1483 }
1478 1484
1485 if (expr->has_function()) {
1486 ASSERT(result_saved);
1487 __ ldr(r0, MemOperand(sp));
1488 __ push(r0);
1489 __ CallRuntime(Runtime::kToFastProperties, 1);
1490 }
1491
1479 if (result_saved) { 1492 if (result_saved) {
1480 context()->PlugTOS(); 1493 context()->PlugTOS();
1481 } else { 1494 } else {
1482 context()->Plug(r0); 1495 context()->Plug(r0);
1483 } 1496 }
1484 } 1497 }
1485 1498
1486 1499
1487 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1500 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1488 Comment cmnt(masm_, "[ ArrayLiteral"); 1501 Comment cmnt(masm_, "[ ArrayLiteral");
(...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after
4299 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4312 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4300 __ add(pc, r1, Operand(masm_->CodeObject())); 4313 __ add(pc, r1, Operand(masm_->CodeObject()));
4301 } 4314 }
4302 4315
4303 4316
4304 #undef __ 4317 #undef __
4305 4318
4306 } } // namespace v8::internal 4319 } } // namespace v8::internal
4307 4320
4308 #endif // V8_TARGET_ARCH_ARM 4321 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698