| OLD | NEW |
| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 354 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 355 // Block literal pools whilst emitting back edge code. | 355 // Block literal pools whilst emitting back edge code. |
| 356 Assembler::BlockConstPoolScope block_const_pool(masm_); | 356 Assembler::BlockConstPoolScope block_const_pool(masm_); |
| 357 Label ok; | 357 Label ok; |
| 358 | 358 |
| 359 int weight = 1; | 359 int weight = 1; |
| 360 if (FLAG_weighted_back_edges) { | 360 if (FLAG_weighted_back_edges) { |
| 361 ASSERT(back_edge_target->is_bound()); | 361 ASSERT(back_edge_target->is_bound()); |
| 362 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 362 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
| 363 weight = Min(kMaxBackEdgeWeight, | 363 weight = Min(kMaxBackEdgeWeight, |
| 364 Max(1, distance / kCodeSizeMultiplier)); | 364 Max(1, distance / kBackEdgeDistanceUnit)); |
| 365 } | 365 } |
| 366 EmitProfilingCounterDecrement(weight); | 366 EmitProfilingCounterDecrement(weight); |
| 367 __ b(pl, &ok); | 367 __ b(pl, &ok); |
| 368 InterruptStub stub; | 368 InterruptStub stub; |
| 369 __ CallStub(&stub); | 369 __ CallStub(&stub); |
| 370 | 370 |
| 371 // Record a mapping of this PC offset to the OSR id. This is used to find | 371 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 372 // the AST id from the unoptimized code in order to use it as a key into | 372 // the AST id from the unoptimized code in order to use it as a key into |
| 373 // the deoptimization input data found in the optimized code. | 373 // the deoptimization input data found in the optimized code. |
| 374 RecordBackEdge(stmt->OsrEntryId()); | 374 RecordBackEdge(stmt->OsrEntryId()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 397 __ CallRuntime(Runtime::kTraceExit, 1); | 397 __ CallRuntime(Runtime::kTraceExit, 1); |
| 398 } | 398 } |
| 399 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { | 399 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { |
| 400 // Pretend that the exit is a backwards jump to the entry. | 400 // Pretend that the exit is a backwards jump to the entry. |
| 401 int weight = 1; | 401 int weight = 1; |
| 402 if (info_->ShouldSelfOptimize()) { | 402 if (info_->ShouldSelfOptimize()) { |
| 403 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 403 weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
| 404 } else if (FLAG_weighted_back_edges) { | 404 } else if (FLAG_weighted_back_edges) { |
| 405 int distance = masm_->pc_offset(); | 405 int distance = masm_->pc_offset(); |
| 406 weight = Min(kMaxBackEdgeWeight, | 406 weight = Min(kMaxBackEdgeWeight, |
| 407 Max(1, distance / kCodeSizeMultiplier)); | 407 Max(1, distance / kBackEdgeDistanceUnit)); |
| 408 } | 408 } |
| 409 EmitProfilingCounterDecrement(weight); | 409 EmitProfilingCounterDecrement(weight); |
| 410 Label ok; | 410 Label ok; |
| 411 __ b(pl, &ok); | 411 __ b(pl, &ok); |
| 412 __ push(r0); | 412 __ push(r0); |
| 413 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { | 413 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { |
| 414 __ ldr(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 414 __ ldr(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 415 __ push(r2); | 415 __ push(r2); |
| 416 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); | 416 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); |
| 417 } else { | 417 } else { |
| (...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 Expression* subexpr = subexprs->at(i); | 1829 Expression* subexpr = subexprs->at(i); |
| 1830 // If the subexpression is a literal or a simple materialized literal it | 1830 // If the subexpression is a literal or a simple materialized literal it |
| 1831 // is already set in the cloned array. | 1831 // is already set in the cloned array. |
| 1832 if (subexpr->AsLiteral() != NULL || | 1832 if (subexpr->AsLiteral() != NULL || |
| 1833 CompileTimeValue::IsCompileTimeValue(subexpr)) { | 1833 CompileTimeValue::IsCompileTimeValue(subexpr)) { |
| 1834 continue; | 1834 continue; |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 if (!result_saved) { | 1837 if (!result_saved) { |
| 1838 __ push(r0); | 1838 __ push(r0); |
| 1839 __ Push(Smi::FromInt(expr->literal_index())); | |
| 1840 result_saved = true; | 1839 result_saved = true; |
| 1841 } | 1840 } |
| 1842 VisitForAccumulatorValue(subexpr); | 1841 VisitForAccumulatorValue(subexpr); |
| 1843 | 1842 |
| 1844 if (IsFastObjectElementsKind(constant_elements_kind)) { | 1843 if (IsFastObjectElementsKind(constant_elements_kind)) { |
| 1845 int offset = FixedArray::kHeaderSize + (i * kPointerSize); | 1844 int offset = FixedArray::kHeaderSize + (i * kPointerSize); |
| 1846 __ ldr(r6, MemOperand(sp, kPointerSize)); // Copy of array literal. | 1845 __ ldr(r6, MemOperand(sp)); // Copy of array literal. |
| 1847 __ ldr(r1, FieldMemOperand(r6, JSObject::kElementsOffset)); | 1846 __ ldr(r1, FieldMemOperand(r6, JSObject::kElementsOffset)); |
| 1848 __ str(result_register(), FieldMemOperand(r1, offset)); | 1847 __ str(result_register(), FieldMemOperand(r1, offset)); |
| 1849 // Update the write barrier for the array store. | 1848 // Update the write barrier for the array store. |
| 1850 __ RecordWriteField(r1, offset, result_register(), r2, | 1849 __ RecordWriteField(r1, offset, result_register(), r2, |
| 1851 kLRHasBeenSaved, kDontSaveFPRegs, | 1850 kLRHasBeenSaved, kDontSaveFPRegs, |
| 1852 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); | 1851 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); |
| 1853 } else { | 1852 } else { |
| 1853 __ ldr(r1, MemOperand(sp)); // Copy of array literal. |
| 1854 __ ldr(r2, FieldMemOperand(r1, JSObject::kMapOffset)); |
| 1854 __ mov(r3, Operand(Smi::FromInt(i))); | 1855 __ mov(r3, Operand(Smi::FromInt(i))); |
| 1856 __ mov(r4, Operand(Smi::FromInt(expr->literal_index()))); |
| 1855 StoreArrayLiteralElementStub stub; | 1857 StoreArrayLiteralElementStub stub; |
| 1856 __ CallStub(&stub); | 1858 __ CallStub(&stub); |
| 1857 } | 1859 } |
| 1858 | 1860 |
| 1859 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); | 1861 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); |
| 1860 } | 1862 } |
| 1861 | 1863 |
| 1862 if (result_saved) { | 1864 if (result_saved) { |
| 1863 __ pop(); // literal index | |
| 1864 context()->PlugTOS(); | 1865 context()->PlugTOS(); |
| 1865 } else { | 1866 } else { |
| 1866 context()->Plug(r0); | 1867 context()->Plug(r0); |
| 1867 } | 1868 } |
| 1868 } | 1869 } |
| 1869 | 1870 |
| 1870 | 1871 |
| 1871 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1872 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| 1872 Comment cmnt(masm_, "[ Assignment"); | 1873 Comment cmnt(masm_, "[ Assignment"); |
| 1873 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | 1874 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' |
| (...skipping 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4893 *context_length = 0; | 4894 *context_length = 0; |
| 4894 return previous_; | 4895 return previous_; |
| 4895 } | 4896 } |
| 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_ARM | 4903 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |