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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 VisitVariableDeclaration(function); | 291 VisitVariableDeclaration(function); |
292 } | 292 } |
293 VisitDeclarations(scope()->declarations()); | 293 VisitDeclarations(scope()->declarations()); |
294 } | 294 } |
295 | 295 |
296 { Comment cmnt(masm_, "[ Stack check"); | 296 { Comment cmnt(masm_, "[ Stack check"); |
297 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); | 297 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); |
298 Label ok; | 298 Label ok; |
299 __ LoadRoot(t0, Heap::kStackLimitRootIndex); | 299 __ LoadRoot(t0, Heap::kStackLimitRootIndex); |
300 __ Branch(&ok, hs, sp, Operand(t0)); | 300 __ Branch(&ok, hs, sp, Operand(t0)); |
301 StackCheckStub stub; | 301 __ Call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); |
302 __ CallStub(&stub); | |
303 __ bind(&ok); | 302 __ bind(&ok); |
304 } | 303 } |
305 | 304 |
306 { Comment cmnt(masm_, "[ Body"); | 305 { Comment cmnt(masm_, "[ Body"); |
307 ASSERT(loop_depth() == 0); | 306 ASSERT(loop_depth() == 0); |
308 VisitStatements(function()->body()); | 307 VisitStatements(function()->body()); |
309 ASSERT(loop_depth() == 0); | 308 ASSERT(loop_depth() == 0); |
310 } | 309 } |
311 } | 310 } |
312 | 311 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 int weight = 1; | 361 int weight = 1; |
363 if (FLAG_weighted_back_edges) { | 362 if (FLAG_weighted_back_edges) { |
364 ASSERT(back_edge_target->is_bound()); | 363 ASSERT(back_edge_target->is_bound()); |
365 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 364 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
366 weight = Min(kMaxBackEdgeWeight, | 365 weight = Min(kMaxBackEdgeWeight, |
367 Max(1, distance / kCodeSizeMultiplier)); | 366 Max(1, distance / kCodeSizeMultiplier)); |
368 } | 367 } |
369 EmitProfilingCounterDecrement(weight); | 368 EmitProfilingCounterDecrement(weight); |
370 __ slt(at, a3, zero_reg); | 369 __ slt(at, a3, zero_reg); |
371 __ beq(at, zero_reg, &ok); | 370 __ beq(at, zero_reg, &ok); |
372 // CallStub will emit a li t9 first, so it is safe to use the delay slot. | 371 // Call will emit a li t9 first, so it is safe to use the delay slot. |
373 InterruptStub stub; | 372 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
374 __ CallStub(&stub); | |
375 // Record a mapping of this PC offset to the OSR id. This is used to find | 373 // Record a mapping of this PC offset to the OSR id. This is used to find |
376 // the AST id from the unoptimized code in order to use it as a key into | 374 // the AST id from the unoptimized code in order to use it as a key into |
377 // the deoptimization input data found in the optimized code. | 375 // the deoptimization input data found in the optimized code. |
378 RecordBackEdge(stmt->OsrEntryId()); | 376 RecordBackEdge(stmt->OsrEntryId()); |
379 EmitProfilingCounterReset(); | 377 EmitProfilingCounterReset(); |
380 | 378 |
381 __ bind(&ok); | 379 __ bind(&ok); |
382 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 380 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
383 // Record a mapping of the OSR id to this PC. This is used if the OSR | 381 // Record a mapping of the OSR id to this PC. This is used if the OSR |
384 // entry becomes the target of a bailout. We don't expect it to be, but | 382 // entry becomes the target of a bailout. We don't expect it to be, but |
(...skipping 26 matching lines...) Expand all Loading... |
411 } | 409 } |
412 EmitProfilingCounterDecrement(weight); | 410 EmitProfilingCounterDecrement(weight); |
413 Label ok; | 411 Label ok; |
414 __ Branch(&ok, ge, a3, Operand(zero_reg)); | 412 __ Branch(&ok, ge, a3, Operand(zero_reg)); |
415 __ push(v0); | 413 __ push(v0); |
416 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { | 414 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { |
417 __ lw(a2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 415 __ lw(a2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
418 __ push(a2); | 416 __ push(a2); |
419 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); | 417 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); |
420 } else { | 418 } else { |
421 InterruptStub stub; | 419 __ Call(isolate()->builtins()->InterruptCheck(), |
422 __ CallStub(&stub); | 420 RelocInfo::CODE_TARGET); |
423 } | 421 } |
424 __ pop(v0); | 422 __ pop(v0); |
425 EmitProfilingCounterReset(); | 423 EmitProfilingCounterReset(); |
426 __ bind(&ok); | 424 __ bind(&ok); |
427 } | 425 } |
428 | 426 |
429 #ifdef DEBUG | 427 #ifdef DEBUG |
430 // Add a label for checking the size of the code used for returning. | 428 // Add a label for checking the size of the code used for returning. |
431 Label check_exit_codesize; | 429 Label check_exit_codesize; |
432 masm_->bind(&check_exit_codesize); | 430 masm_->bind(&check_exit_codesize); |
(...skipping 4485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4918 *context_length = 0; | 4916 *context_length = 0; |
4919 return previous_; | 4917 return previous_; |
4920 } | 4918 } |
4921 | 4919 |
4922 | 4920 |
4923 #undef __ | 4921 #undef __ |
4924 | 4922 |
4925 } } // namespace v8::internal | 4923 } } // namespace v8::internal |
4926 | 4924 |
4927 #endif // V8_TARGET_ARCH_MIPS | 4925 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |