OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ | 5 #ifndef V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ |
6 #define V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ | 6 #define V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ |
7 | 7 |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/lithium-codegen.h" | 9 #include "src/lithium-codegen.h" |
10 #include "src/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/mips64/lithium-gap-resolver-mips64.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // Support for recording safepoint and position information. | 263 // Support for recording safepoint and position information. |
264 void RecordSafepoint(LPointerMap* pointers, | 264 void RecordSafepoint(LPointerMap* pointers, |
265 Safepoint::Kind kind, | 265 Safepoint::Kind kind, |
266 int arguments, | 266 int arguments, |
267 Safepoint::DeoptMode mode); | 267 Safepoint::DeoptMode mode); |
268 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode); | 268 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode); |
269 void RecordSafepoint(Safepoint::DeoptMode mode); | 269 void RecordSafepoint(Safepoint::DeoptMode mode); |
270 void RecordSafepointWithRegisters(LPointerMap* pointers, | 270 void RecordSafepointWithRegisters(LPointerMap* pointers, |
271 int arguments, | 271 int arguments, |
272 Safepoint::DeoptMode mode); | 272 Safepoint::DeoptMode mode); |
273 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, | |
274 int arguments, | |
275 Safepoint::DeoptMode mode); | |
276 | 273 |
277 void RecordAndWritePosition(int position) V8_OVERRIDE; | 274 void RecordAndWritePosition(int position) V8_OVERRIDE; |
278 | 275 |
279 static Condition TokenToCondition(Token::Value op, bool is_unsigned); | 276 static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
280 void EmitGoto(int block); | 277 void EmitGoto(int block); |
281 | 278 |
282 // EmitBranch expects to be the last instruction of a block. | 279 // EmitBranch expects to be the last instruction of a block. |
283 template<class InstrType> | 280 template<class InstrType> |
284 void EmitBranch(InstrType instr, | 281 void EmitBranch(InstrType instr, |
285 Condition condition, | 282 Condition condition, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 377 |
381 // Builder that keeps track of safepoints in the code. The table | 378 // Builder that keeps track of safepoints in the code. The table |
382 // itself is emitted at the end of the generated code. | 379 // itself is emitted at the end of the generated code. |
383 SafepointTableBuilder safepoints_; | 380 SafepointTableBuilder safepoints_; |
384 | 381 |
385 // Compiler from a set of parallel moves to a sequential list of moves. | 382 // Compiler from a set of parallel moves to a sequential list of moves. |
386 LGapResolver resolver_; | 383 LGapResolver resolver_; |
387 | 384 |
388 Safepoint::Kind expected_safepoint_kind_; | 385 Safepoint::Kind expected_safepoint_kind_; |
389 | 386 |
390 class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED { | 387 class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED { |
391 public: | 388 public: |
392 PushSafepointRegistersScope(LCodeGen* codegen, | 389 explicit PushSafepointRegistersScope(LCodeGen* codegen) |
393 Safepoint::Kind kind) | |
394 : codegen_(codegen) { | 390 : codegen_(codegen) { |
395 ASSERT(codegen_->info()->is_calling()); | 391 ASSERT(codegen_->info()->is_calling()); |
396 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 392 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
397 codegen_->expected_safepoint_kind_ = kind; | 393 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; |
398 | 394 |
399 switch (codegen_->expected_safepoint_kind_) { | 395 StoreRegistersStateStub stub(codegen_->isolate()); |
400 case Safepoint::kWithRegisters: { | 396 codegen_->masm_->push(ra); |
401 StoreRegistersStateStub stub1(codegen_->masm_->isolate(), | 397 codegen_->masm_->CallStub(&stub); |
402 kDontSaveFPRegs); | |
403 codegen_->masm_->push(ra); | |
404 codegen_->masm_->CallStub(&stub1); | |
405 break; | |
406 } | |
407 case Safepoint::kWithRegistersAndDoubles: { | |
408 StoreRegistersStateStub stub2(codegen_->masm_->isolate(), | |
409 kSaveFPRegs); | |
410 codegen_->masm_->push(ra); | |
411 codegen_->masm_->CallStub(&stub2); | |
412 break; | |
413 } | |
414 default: | |
415 UNREACHABLE(); | |
416 } | |
417 } | 398 } |
418 | 399 |
419 ~PushSafepointRegistersScope() { | 400 ~PushSafepointRegistersScope() { |
420 Safepoint::Kind kind = codegen_->expected_safepoint_kind_; | 401 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); |
421 ASSERT((kind & Safepoint::kWithRegisters) != 0); | 402 RestoreRegistersStateStub stub(codegen_->isolate()); |
422 switch (kind) { | 403 codegen_->masm_->push(ra); |
423 case Safepoint::kWithRegisters: { | 404 codegen_->masm_->CallStub(&stub); |
424 RestoreRegistersStateStub stub1(codegen_->masm_->isolate(), | |
425 kDontSaveFPRegs); | |
426 codegen_->masm_->push(ra); | |
427 codegen_->masm_->CallStub(&stub1); | |
428 break; | |
429 } | |
430 case Safepoint::kWithRegistersAndDoubles: { | |
431 RestoreRegistersStateStub stub2(codegen_->masm_->isolate(), | |
432 kSaveFPRegs); | |
433 codegen_->masm_->push(ra); | |
434 codegen_->masm_->CallStub(&stub2); | |
435 break; | |
436 } | |
437 default: | |
438 UNREACHABLE(); | |
439 } | |
440 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; | 405 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; |
441 } | 406 } |
442 | 407 |
443 private: | 408 private: |
444 LCodeGen* codegen_; | 409 LCodeGen* codegen_; |
445 }; | 410 }; |
446 | 411 |
447 friend class LDeferredCode; | 412 friend class LDeferredCode; |
448 friend class LEnvironment; | 413 friend class LEnvironment; |
449 friend class SafepointGenerator; | 414 friend class SafepointGenerator; |
(...skipping 27 matching lines...) Expand all Loading... |
477 LCodeGen* codegen_; | 442 LCodeGen* codegen_; |
478 Label entry_; | 443 Label entry_; |
479 Label exit_; | 444 Label exit_; |
480 Label* external_exit_; | 445 Label* external_exit_; |
481 int instruction_index_; | 446 int instruction_index_; |
482 }; | 447 }; |
483 | 448 |
484 } } // namespace v8::internal | 449 } } // namespace v8::internal |
485 | 450 |
486 #endif // V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ | 451 #endif // V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ |
OLD | NEW |