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

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

Issue 8598014: Implement code stub for object literal creation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Florian Schneider. Created 9 years, 1 month 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 | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('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 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 if ((size % (2 * kPointerSize)) != 0) { 1367 if ((size % (2 * kPointerSize)) != 0) {
1368 __ mov(edx, FieldOperand(ebx, size - kPointerSize)); 1368 __ mov(edx, FieldOperand(ebx, size - kPointerSize));
1369 __ mov(FieldOperand(eax, size - kPointerSize), edx); 1369 __ mov(FieldOperand(eax, size - kPointerSize), edx);
1370 } 1370 }
1371 context()->Plug(eax); 1371 context()->Plug(eax);
1372 } 1372 }
1373 1373
1374 1374
1375 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1375 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1376 Comment cmnt(masm_, "[ ObjectLiteral"); 1376 Comment cmnt(masm_, "[ ObjectLiteral");
1377 Handle<FixedArray> constant_properties = expr->constant_properties();
1377 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1378 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1378 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); 1379 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset));
1379 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1380 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1380 __ push(Immediate(expr->constant_properties())); 1381 __ push(Immediate(constant_properties));
1381 int flags = expr->fast_elements() 1382 int flags = expr->fast_elements()
1382 ? ObjectLiteral::kFastElements 1383 ? ObjectLiteral::kFastElements
1383 : ObjectLiteral::kNoFlags; 1384 : ObjectLiteral::kNoFlags;
1384 flags |= expr->has_function() 1385 flags |= expr->has_function()
1385 ? ObjectLiteral::kHasFunction 1386 ? ObjectLiteral::kHasFunction
1386 : ObjectLiteral::kNoFlags; 1387 : ObjectLiteral::kNoFlags;
1387 __ push(Immediate(Smi::FromInt(flags))); 1388 __ push(Immediate(Smi::FromInt(flags)));
1389 int properties_count = constant_properties->length() / 2;
1388 if (expr->depth() > 1) { 1390 if (expr->depth() > 1) {
1389 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1391 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1392 } else if (flags != ObjectLiteral::kFastElements ||
1393 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1394 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
1390 } else { 1395 } else {
1391 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); 1396 FastCloneShallowObjectStub stub(properties_count);
1397 __ CallStub(&stub);
1392 } 1398 }
1393 1399
1394 // If result_saved is true the result is on top of the stack. If 1400 // If result_saved is true the result is on top of the stack. If
1395 // result_saved is false the result is in eax. 1401 // result_saved is false the result is in eax.
1396 bool result_saved = false; 1402 bool result_saved = false;
1397 1403
1398 // Mark all computed expressions that are bound to a key that 1404 // Mark all computed expressions that are bound to a key that
1399 // is shadowed by a later occurrence of the same key. For the 1405 // is shadowed by a later occurrence of the same key. For the
1400 // marked expressions, no store code is emitted. 1406 // marked expressions, no store code is emitted.
1401 expr->CalculateEmitStore(); 1407 expr->CalculateEmitStore();
(...skipping 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after
4348 *context_length = 0; 4354 *context_length = 0;
4349 return previous_; 4355 return previous_;
4350 } 4356 }
4351 4357
4352 4358
4353 #undef __ 4359 #undef __
4354 4360
4355 } } // namespace v8::internal 4361 } } // namespace v8::internal
4356 4362
4357 #endif // V8_TARGET_ARCH_IA32 4363 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698