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

Side by Side Diff: src/ia32/full-codegen-ia32.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/ia32/code-stubs-ia32.cc ('k') | src/ia32/ic-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 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, 335 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt,
336 Label* back_edge_target) { 336 Label* back_edge_target) {
337 Comment cmnt(masm_, "[ Back edge bookkeeping"); 337 Comment cmnt(masm_, "[ Back edge bookkeeping");
338 Label ok; 338 Label ok;
339 339
340 int weight = 1; 340 int weight = 1;
341 if (FLAG_weighted_back_edges) { 341 if (FLAG_weighted_back_edges) {
342 ASSERT(back_edge_target->is_bound()); 342 ASSERT(back_edge_target->is_bound());
343 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); 343 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
344 weight = Min(kMaxBackEdgeWeight, 344 weight = Min(kMaxBackEdgeWeight,
345 Max(1, distance / kCodeSizeMultiplier)); 345 Max(1, distance / kBackEdgeDistanceUnit));
346 } 346 }
347 EmitProfilingCounterDecrement(weight); 347 EmitProfilingCounterDecrement(weight);
348 __ j(positive, &ok, Label::kNear); 348 __ j(positive, &ok, Label::kNear);
349 InterruptStub stub; 349 InterruptStub stub;
350 __ CallStub(&stub); 350 __ CallStub(&stub);
351 351
352 // Record a mapping of this PC offset to the OSR id. This is used to find 352 // Record a mapping of this PC offset to the OSR id. This is used to find
353 // the AST id from the unoptimized code in order to use it as a key into 353 // the AST id from the unoptimized code in order to use it as a key into
354 // the deoptimization input data found in the optimized code. 354 // the deoptimization input data found in the optimized code.
355 RecordBackEdge(stmt->OsrEntryId()); 355 RecordBackEdge(stmt->OsrEntryId());
(...skipping 21 matching lines...) Expand all
377 __ CallRuntime(Runtime::kTraceExit, 1); 377 __ CallRuntime(Runtime::kTraceExit, 1);
378 } 378 }
379 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { 379 if (FLAG_interrupt_at_exit || FLAG_self_optimization) {
380 // Pretend that the exit is a backwards jump to the entry. 380 // Pretend that the exit is a backwards jump to the entry.
381 int weight = 1; 381 int weight = 1;
382 if (info_->ShouldSelfOptimize()) { 382 if (info_->ShouldSelfOptimize()) {
383 weight = FLAG_interrupt_budget / FLAG_self_opt_count; 383 weight = FLAG_interrupt_budget / FLAG_self_opt_count;
384 } else if (FLAG_weighted_back_edges) { 384 } else if (FLAG_weighted_back_edges) {
385 int distance = masm_->pc_offset(); 385 int distance = masm_->pc_offset();
386 weight = Min(kMaxBackEdgeWeight, 386 weight = Min(kMaxBackEdgeWeight,
387 Max(1, distance / kCodeSizeMultiplier)); 387 Max(1, distance / kBackEdgeDistanceUnit));
388 } 388 }
389 EmitProfilingCounterDecrement(weight); 389 EmitProfilingCounterDecrement(weight);
390 Label ok; 390 Label ok;
391 __ j(positive, &ok, Label::kNear); 391 __ j(positive, &ok, Label::kNear);
392 __ push(eax); 392 __ push(eax);
393 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { 393 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) {
394 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 394 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
395 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); 395 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1);
396 } else { 396 } else {
397 InterruptStub stub; 397 InterruptStub stub;
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 for (int i = 0; i < length; i++) { 1781 for (int i = 0; i < length; i++) {
1782 Expression* subexpr = subexprs->at(i); 1782 Expression* subexpr = subexprs->at(i);
1783 // If the subexpression is a literal or a simple materialized literal it 1783 // If the subexpression is a literal or a simple materialized literal it
1784 // is already set in the cloned array. 1784 // is already set in the cloned array.
1785 if (subexpr->AsLiteral() != NULL || 1785 if (subexpr->AsLiteral() != NULL ||
1786 CompileTimeValue::IsCompileTimeValue(subexpr)) { 1786 CompileTimeValue::IsCompileTimeValue(subexpr)) {
1787 continue; 1787 continue;
1788 } 1788 }
1789 1789
1790 if (!result_saved) { 1790 if (!result_saved) {
1791 __ push(eax); // array literal. 1791 __ push(eax);
1792 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1793 result_saved = true; 1792 result_saved = true;
1794 } 1793 }
1795 VisitForAccumulatorValue(subexpr); 1794 VisitForAccumulatorValue(subexpr);
1796 1795
1797 if (IsFastObjectElementsKind(constant_elements_kind)) { 1796 if (IsFastObjectElementsKind(constant_elements_kind)) {
1798 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they 1797 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they
1799 // cannot transition and don't need to call the runtime stub. 1798 // cannot transition and don't need to call the runtime stub.
1800 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1799 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1801 __ mov(ebx, Operand(esp, kPointerSize)); // Copy of array literal. 1800 __ mov(ebx, Operand(esp, 0)); // Copy of array literal.
1802 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); 1801 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset));
1803 // Store the subexpression value in the array's elements. 1802 // Store the subexpression value in the array's elements.
1804 __ mov(FieldOperand(ebx, offset), result_register()); 1803 __ mov(FieldOperand(ebx, offset), result_register());
1805 // Update the write barrier for the array store. 1804 // Update the write barrier for the array store.
1806 __ RecordWriteField(ebx, offset, result_register(), ecx, 1805 __ RecordWriteField(ebx, offset, result_register(), ecx,
1807 kDontSaveFPRegs, 1806 kDontSaveFPRegs,
1808 EMIT_REMEMBERED_SET, 1807 EMIT_REMEMBERED_SET,
1809 INLINE_SMI_CHECK); 1808 INLINE_SMI_CHECK);
1810 } else { 1809 } else {
1811 // Store the subexpression value in the array's elements. 1810 // Store the subexpression value in the array's elements.
1811 __ mov(ebx, Operand(esp, 0)); // Copy of array literal.
1812 __ mov(edi, FieldOperand(ebx, JSObject::kMapOffset));
1812 __ mov(ecx, Immediate(Smi::FromInt(i))); 1813 __ mov(ecx, Immediate(Smi::FromInt(i)));
1814 __ mov(edx, Immediate(Smi::FromInt(expr->literal_index())));
1813 StoreArrayLiteralElementStub stub; 1815 StoreArrayLiteralElementStub stub;
1814 __ CallStub(&stub); 1816 __ CallStub(&stub);
1815 } 1817 }
1816 1818
1817 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); 1819 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS);
1818 } 1820 }
1819 1821
1820 if (result_saved) { 1822 if (result_saved) {
1821 __ add(esp, Immediate(kPointerSize)); // literal index
1822 context()->PlugTOS(); 1823 context()->PlugTOS();
1823 } else { 1824 } else {
1824 context()->Plug(eax); 1825 context()->Plug(eax);
1825 } 1826 }
1826 } 1827 }
1827 1828
1828 1829
1829 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1830 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1830 Comment cmnt(masm_, "[ Assignment"); 1831 Comment cmnt(masm_, "[ Assignment");
1831 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' 1832 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
(...skipping 3061 matching lines...) Expand 10 before | Expand all | Expand 10 after
4893 *stack_depth = 0; 4894 *stack_depth = 0;
4894 *context_length = 0; 4895 *context_length = 0;
4895 return previous_; 4896 return previous_;
4896 } 4897 }
4897 4898
4898 #undef __ 4899 #undef __
4899 4900
4900 } } // namespace v8::internal 4901 } } // namespace v8::internal
4901 4902
4902 #endif // V8_TARGET_ARCH_IA32 4903 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698