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

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

Issue 17162002: Version 3.19.17. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 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 | « src/x64/code-stubs-x64.cc ('k') | src/x64/ic-x64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, 330 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt,
331 Label* back_edge_target) { 331 Label* back_edge_target) {
332 Comment cmnt(masm_, "[ Back edge bookkeeping"); 332 Comment cmnt(masm_, "[ Back edge bookkeeping");
333 Label ok; 333 Label ok;
334 334
335 int weight = 1; 335 int weight = 1;
336 if (FLAG_weighted_back_edges) { 336 if (FLAG_weighted_back_edges) {
337 ASSERT(back_edge_target->is_bound()); 337 ASSERT(back_edge_target->is_bound());
338 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); 338 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
339 weight = Min(kMaxBackEdgeWeight, 339 weight = Min(kMaxBackEdgeWeight,
340 Max(1, distance / kCodeSizeMultiplier)); 340 Max(1, distance / kBackEdgeDistanceUnit));
341 } 341 }
342 EmitProfilingCounterDecrement(weight); 342 EmitProfilingCounterDecrement(weight);
343 __ j(positive, &ok, Label::kNear); 343 __ j(positive, &ok, Label::kNear);
344 InterruptStub stub; 344 InterruptStub stub;
345 __ CallStub(&stub); 345 __ CallStub(&stub);
346 346
347 // Record a mapping of this PC offset to the OSR id. This is used to find 347 // Record a mapping of this PC offset to the OSR id. This is used to find
348 // the AST id from the unoptimized code in order to use it as a key into 348 // the AST id from the unoptimized code in order to use it as a key into
349 // the deoptimization input data found in the optimized code. 349 // the deoptimization input data found in the optimized code.
350 RecordBackEdge(stmt->OsrEntryId()); 350 RecordBackEdge(stmt->OsrEntryId());
(...skipping 20 matching lines...) Expand all
371 __ CallRuntime(Runtime::kTraceExit, 1); 371 __ CallRuntime(Runtime::kTraceExit, 1);
372 } 372 }
373 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { 373 if (FLAG_interrupt_at_exit || FLAG_self_optimization) {
374 // Pretend that the exit is a backwards jump to the entry. 374 // Pretend that the exit is a backwards jump to the entry.
375 int weight = 1; 375 int weight = 1;
376 if (info_->ShouldSelfOptimize()) { 376 if (info_->ShouldSelfOptimize()) {
377 weight = FLAG_interrupt_budget / FLAG_self_opt_count; 377 weight = FLAG_interrupt_budget / FLAG_self_opt_count;
378 } else if (FLAG_weighted_back_edges) { 378 } else if (FLAG_weighted_back_edges) {
379 int distance = masm_->pc_offset(); 379 int distance = masm_->pc_offset();
380 weight = Min(kMaxBackEdgeWeight, 380 weight = Min(kMaxBackEdgeWeight,
381 Max(1, distance / kCodeSizeMultiplier)); 381 Max(1, distance / kBackEdgeDistanceUnit));
382 } 382 }
383 EmitProfilingCounterDecrement(weight); 383 EmitProfilingCounterDecrement(weight);
384 Label ok; 384 Label ok;
385 __ j(positive, &ok, Label::kNear); 385 __ j(positive, &ok, Label::kNear);
386 __ push(rax); 386 __ push(rax);
387 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { 387 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) {
388 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 388 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
389 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); 389 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1);
390 } else { 390 } else {
391 InterruptStub stub; 391 InterruptStub stub;
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 for (int i = 0; i < length; i++) { 1805 for (int i = 0; i < length; i++) {
1806 Expression* subexpr = subexprs->at(i); 1806 Expression* subexpr = subexprs->at(i);
1807 // If the subexpression is a literal or a simple materialized literal it 1807 // If the subexpression is a literal or a simple materialized literal it
1808 // is already set in the cloned array. 1808 // is already set in the cloned array.
1809 if (subexpr->AsLiteral() != NULL || 1809 if (subexpr->AsLiteral() != NULL ||
1810 CompileTimeValue::IsCompileTimeValue(subexpr)) { 1810 CompileTimeValue::IsCompileTimeValue(subexpr)) {
1811 continue; 1811 continue;
1812 } 1812 }
1813 1813
1814 if (!result_saved) { 1814 if (!result_saved) {
1815 __ push(rax); // array literal 1815 __ push(rax);
1816 __ Push(Smi::FromInt(expr->literal_index()));
1817 result_saved = true; 1816 result_saved = true;
1818 } 1817 }
1819 VisitForAccumulatorValue(subexpr); 1818 VisitForAccumulatorValue(subexpr);
1820 1819
1821 if (IsFastObjectElementsKind(constant_elements_kind)) { 1820 if (IsFastObjectElementsKind(constant_elements_kind)) {
1822 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they 1821 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they
1823 // cannot transition and don't need to call the runtime stub. 1822 // cannot transition and don't need to call the runtime stub.
1824 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1823 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1825 __ movq(rbx, Operand(rsp, kPointerSize)); // Copy of array literal. 1824 __ movq(rbx, Operand(rsp, 0)); // Copy of array literal.
1826 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); 1825 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset));
1827 // Store the subexpression value in the array's elements. 1826 // Store the subexpression value in the array's elements.
1828 __ movq(FieldOperand(rbx, offset), result_register()); 1827 __ movq(FieldOperand(rbx, offset), result_register());
1829 // Update the write barrier for the array store. 1828 // Update the write barrier for the array store.
1830 __ RecordWriteField(rbx, offset, result_register(), rcx, 1829 __ RecordWriteField(rbx, offset, result_register(), rcx,
1831 kDontSaveFPRegs, 1830 kDontSaveFPRegs,
1832 EMIT_REMEMBERED_SET, 1831 EMIT_REMEMBERED_SET,
1833 INLINE_SMI_CHECK); 1832 INLINE_SMI_CHECK);
1834 } else { 1833 } else {
1835 // Store the subexpression value in the array's elements. 1834 // Store the subexpression value in the array's elements.
1835 __ movq(rbx, Operand(rsp, 0)); // Copy of array literal.
1836 __ movq(rdi, FieldOperand(rbx, JSObject::kMapOffset));
1836 __ Move(rcx, Smi::FromInt(i)); 1837 __ Move(rcx, Smi::FromInt(i));
1838 __ Move(rdx, Smi::FromInt(expr->literal_index()));
1837 StoreArrayLiteralElementStub stub; 1839 StoreArrayLiteralElementStub stub;
1838 __ CallStub(&stub); 1840 __ CallStub(&stub);
1839 } 1841 }
1840 1842
1841 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); 1843 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS);
1842 } 1844 }
1843 1845
1844 if (result_saved) { 1846 if (result_saved) {
1845 __ addq(rsp, Immediate(kPointerSize)); // literal index
1846 context()->PlugTOS(); 1847 context()->PlugTOS();
1847 } else { 1848 } else {
1848 context()->Plug(rax); 1849 context()->Plug(rax);
1849 } 1850 }
1850 } 1851 }
1851 1852
1852 1853
1853 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1854 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1854 Comment cmnt(masm_, "[ Assignment"); 1855 Comment cmnt(masm_, "[ Assignment");
1855 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' 1856 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
(...skipping 3024 matching lines...) Expand 10 before | Expand all | Expand 10 after
4880 *context_length = 0; 4881 *context_length = 0;
4881 return previous_; 4882 return previous_;
4882 } 4883 }
4883 4884
4884 4885
4885 #undef __ 4886 #undef __
4886 4887
4887 } } // namespace v8::internal 4888 } } // namespace v8::internal
4888 4889
4889 #endif // V8_TARGET_ARCH_X64 4890 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698