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