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

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

Issue 8574058: Add version of x64 FastCloneShallowArrayStub that copies all boilerplate kinds (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback 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/x64/code-stubs-x64.cc ('k') | no next file » | 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 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 } 1473 }
1474 1474
1475 1475
1476 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1476 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1477 Comment cmnt(masm_, "[ ArrayLiteral"); 1477 Comment cmnt(masm_, "[ ArrayLiteral");
1478 1478
1479 ZoneList<Expression*>* subexprs = expr->values(); 1479 ZoneList<Expression*>* subexprs = expr->values();
1480 int length = subexprs->length(); 1480 int length = subexprs->length();
1481 Handle<FixedArray> constant_elements = expr->constant_elements(); 1481 Handle<FixedArray> constant_elements = expr->constant_elements();
1482 ASSERT_EQ(2, constant_elements->length()); 1482 ASSERT_EQ(2, constant_elements->length());
1483 #if DEBUG
1483 ElementsKind constant_elements_kind = 1484 ElementsKind constant_elements_kind =
1484 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1485 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1486 #endif
1485 Handle<FixedArrayBase> constant_elements_values( 1487 Handle<FixedArrayBase> constant_elements_values(
1486 FixedArrayBase::cast(constant_elements->get(1))); 1488 FixedArrayBase::cast(constant_elements->get(1)));
1487 1489
1488 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1490 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1489 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); 1491 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset));
1490 __ Push(Smi::FromInt(expr->literal_index())); 1492 __ Push(Smi::FromInt(expr->literal_index()));
1491 __ Push(constant_elements); 1493 __ Push(constant_elements);
1492 if (constant_elements_values->map() == 1494 if (expr->depth() > 1) {
1493 isolate()->heap()->fixed_cow_array_map()) {
1494 FastCloneShallowArrayStub stub(
1495 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
1496 __ CallStub(&stub);
1497 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1498 } else if (expr->depth() > 1) {
1499 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1495 __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
1500 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1496 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1501 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); 1497 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3);
1502 } else { 1498 } else {
1503 ASSERT(constant_elements_kind == FAST_ELEMENTS || 1499 ASSERT(constant_elements_kind == FAST_ELEMENTS ||
1504 constant_elements_kind == FAST_SMI_ONLY_ELEMENTS || 1500 constant_elements_kind == FAST_SMI_ONLY_ELEMENTS ||
1505 FLAG_smi_only_arrays); 1501 FLAG_smi_only_arrays);
1506 FastCloneShallowArrayStub::Mode mode = 1502 if (constant_elements_values->map() ==
1507 constant_elements_kind == FAST_DOUBLE_ELEMENTS 1503 isolate()->heap()->fixed_cow_array_map()) {
1508 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS 1504 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(),
1509 : FastCloneShallowArrayStub::CLONE_ELEMENTS; 1505 1);
1510 FastCloneShallowArrayStub stub(mode, length); 1506 }
1507 FastCloneShallowArrayStub stub(
1508 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS, length);
1511 __ CallStub(&stub); 1509 __ CallStub(&stub);
1512 } 1510 }
1513 1511
1514 bool result_saved = false; // Is the result saved to the stack? 1512 bool result_saved = false; // Is the result saved to the stack?
1515 1513
1516 // Emit code to evaluate all the non-constant subexpressions and to store 1514 // Emit code to evaluate all the non-constant subexpressions and to store
1517 // them into the newly cloned array. 1515 // them into the newly cloned array.
1518 for (int i = 0; i < length; i++) { 1516 for (int i = 0; i < length; i++) {
1519 Expression* subexpr = subexprs->at(i); 1517 Expression* subexpr = subexprs->at(i);
1520 // If the subexpression is a literal or a simple materialized literal it 1518 // If the subexpression is a literal or a simple materialized literal it
(...skipping 2786 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 *context_length = 0; 4305 *context_length = 0;
4308 return previous_; 4306 return previous_;
4309 } 4307 }
4310 4308
4311 4309
4312 #undef __ 4310 #undef __
4313 4311
4314 } } // namespace v8::internal 4312 } } // namespace v8::internal
4315 4313
4316 #endif // V8_TARGET_ARCH_X64 4314 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698