| 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 26 matching lines...) Expand all Loading... |
| 37 #include "v8utils.h" | 37 #include "v8utils.h" |
| 38 #include "x64/lithium-gap-resolver-x64.h" | 38 #include "x64/lithium-gap-resolver-x64.h" |
| 39 | 39 |
| 40 namespace v8 { | 40 namespace v8 { |
| 41 namespace internal { | 41 namespace internal { |
| 42 | 42 |
| 43 // Forward declarations. | 43 // Forward declarations. |
| 44 class LDeferredCode; | 44 class LDeferredCode; |
| 45 class SafepointGenerator; | 45 class SafepointGenerator; |
| 46 | 46 |
| 47 class LCodeGen BASE_EMBEDDED { | 47 class LCodeGen V8_FINAL BASE_EMBEDDED { |
| 48 public: | 48 public: |
| 49 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) | 49 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) |
| 50 : zone_(info->zone()), | 50 : zone_(info->zone()), |
| 51 chunk_(static_cast<LPlatformChunk*>(chunk)), | 51 chunk_(static_cast<LPlatformChunk*>(chunk)), |
| 52 masm_(assembler), | 52 masm_(assembler), |
| 53 info_(info), | 53 info_(info), |
| 54 current_block_(-1), | 54 current_block_(-1), |
| 55 current_instruction_(-1), | 55 current_instruction_(-1), |
| 56 instructions_(chunk->instructions()), | 56 instructions_(chunk->instructions()), |
| 57 deoptimizations_(4, info->zone()), | 57 deoptimizations_(4, info->zone()), |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 void RecordSafepointWithRegisters(LPointerMap* pointers, | 282 void RecordSafepointWithRegisters(LPointerMap* pointers, |
| 283 int arguments, | 283 int arguments, |
| 284 Safepoint::DeoptMode mode); | 284 Safepoint::DeoptMode mode); |
| 285 void RecordPosition(int position); | 285 void RecordPosition(int position); |
| 286 void RecordAndUpdatePosition(int position); | 286 void RecordAndUpdatePosition(int position); |
| 287 | 287 |
| 288 static Condition TokenToCondition(Token::Value op, bool is_unsigned); | 288 static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
| 289 void EmitGoto(int block); | 289 void EmitGoto(int block); |
| 290 template<class InstrType> | 290 template<class InstrType> |
| 291 void EmitBranch(InstrType instr, Condition cc); | 291 void EmitBranch(InstrType instr, Condition cc); |
| 292 template<class InstrType> |
| 293 void EmitFalseBranch(InstrType instr, Condition cc); |
| 292 void EmitNumberUntagD( | 294 void EmitNumberUntagD( |
| 293 Register input, | 295 Register input, |
| 294 XMMRegister result, | 296 XMMRegister result, |
| 295 bool allow_undefined_as_nan, | 297 bool allow_undefined_as_nan, |
| 296 bool deoptimize_on_minus_zero, | 298 bool deoptimize_on_minus_zero, |
| 297 LEnvironment* env, | 299 LEnvironment* env, |
| 298 NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED); | 300 NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED); |
| 299 | 301 |
| 300 // Emits optimized code for typeof x == "y". Modifies input register. | 302 // Emits optimized code for typeof x == "y". Modifies input register. |
| 301 // Returns the condition on which a final split to | 303 // Returns the condition on which a final split to |
| (...skipping 15 matching lines...) Expand all Loading... |
| 317 // true and false label should be made, to optimize fallthrough. | 319 // true and false label should be made, to optimize fallthrough. |
| 318 Condition EmitIsString(Register input, | 320 Condition EmitIsString(Register input, |
| 319 Register temp1, | 321 Register temp1, |
| 320 Label* is_not_string, | 322 Label* is_not_string, |
| 321 SmiCheck check_needed); | 323 SmiCheck check_needed); |
| 322 | 324 |
| 323 // Emits optimized code for %_IsConstructCall(). | 325 // Emits optimized code for %_IsConstructCall(). |
| 324 // Caller should branch on equal condition. | 326 // Caller should branch on equal condition. |
| 325 void EmitIsConstructCall(Register temp); | 327 void EmitIsConstructCall(Register temp); |
| 326 | 328 |
| 327 void EmitLoadFieldOrConstantFunction(Register result, | |
| 328 Register object, | |
| 329 Handle<Map> type, | |
| 330 Handle<String> name, | |
| 331 LEnvironment* env); | |
| 332 | |
| 333 // Emits code for pushing either a tagged constant, a (non-double) | 329 // Emits code for pushing either a tagged constant, a (non-double) |
| 334 // register, or a stack slot operand. | 330 // register, or a stack slot operand. |
| 335 void EmitPushTaggedOperand(LOperand* operand); | 331 void EmitPushTaggedOperand(LOperand* operand); |
| 336 | 332 |
| 337 // Emits optimized code to deep-copy the contents of statically known | 333 // Emits optimized code to deep-copy the contents of statically known |
| 338 // object graphs (e.g. object literal boilerplate). | 334 // object graphs (e.g. object literal boilerplate). |
| 339 void EmitDeepCopy(Handle<JSObject> object, | 335 void EmitDeepCopy(Handle<JSObject> object, |
| 340 Register result, | 336 Register result, |
| 341 Register source, | 337 Register source, |
| 342 int* offset, | 338 int* offset, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // itself is emitted at the end of the generated code. | 377 // itself is emitted at the end of the generated code. |
| 382 SafepointTableBuilder safepoints_; | 378 SafepointTableBuilder safepoints_; |
| 383 | 379 |
| 384 // Compiler from a set of parallel moves to a sequential list of moves. | 380 // Compiler from a set of parallel moves to a sequential list of moves. |
| 385 LGapResolver resolver_; | 381 LGapResolver resolver_; |
| 386 | 382 |
| 387 Safepoint::Kind expected_safepoint_kind_; | 383 Safepoint::Kind expected_safepoint_kind_; |
| 388 | 384 |
| 389 int old_position_; | 385 int old_position_; |
| 390 | 386 |
| 391 class PushSafepointRegistersScope BASE_EMBEDDED { | 387 class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED { |
| 392 public: | 388 public: |
| 393 explicit PushSafepointRegistersScope(LCodeGen* codegen) | 389 explicit PushSafepointRegistersScope(LCodeGen* codegen) |
| 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_->masm_->PushSafepointRegisters(); | 393 codegen_->masm_->PushSafepointRegisters(); |
| 398 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; | 394 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; |
| 399 } | 395 } |
| 400 | 396 |
| 401 ~PushSafepointRegistersScope() { | 397 ~PushSafepointRegistersScope() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 417 | 413 |
| 418 class LDeferredCode: public ZoneObject { | 414 class LDeferredCode: public ZoneObject { |
| 419 public: | 415 public: |
| 420 explicit LDeferredCode(LCodeGen* codegen) | 416 explicit LDeferredCode(LCodeGen* codegen) |
| 421 : codegen_(codegen), | 417 : codegen_(codegen), |
| 422 external_exit_(NULL), | 418 external_exit_(NULL), |
| 423 instruction_index_(codegen->current_instruction_) { | 419 instruction_index_(codegen->current_instruction_) { |
| 424 codegen->AddDeferredCode(this); | 420 codegen->AddDeferredCode(this); |
| 425 } | 421 } |
| 426 | 422 |
| 427 virtual ~LDeferredCode() { } | 423 virtual ~LDeferredCode() {} |
| 428 virtual void Generate() = 0; | 424 virtual void Generate() = 0; |
| 429 virtual LInstruction* instr() = 0; | 425 virtual LInstruction* instr() = 0; |
| 430 | 426 |
| 431 void SetExit(Label* exit) { external_exit_ = exit; } | 427 void SetExit(Label* exit) { external_exit_ = exit; } |
| 432 Label* entry() { return &entry_; } | 428 Label* entry() { return &entry_; } |
| 433 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } | 429 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } |
| 434 int instruction_index() const { return instruction_index_; } | 430 int instruction_index() const { return instruction_index_; } |
| 435 | 431 |
| 436 protected: | 432 protected: |
| 437 LCodeGen* codegen() const { return codegen_; } | 433 LCodeGen* codegen() const { return codegen_; } |
| 438 MacroAssembler* masm() const { return codegen_->masm(); } | 434 MacroAssembler* masm() const { return codegen_->masm(); } |
| 439 | 435 |
| 440 private: | 436 private: |
| 441 LCodeGen* codegen_; | 437 LCodeGen* codegen_; |
| 442 Label entry_; | 438 Label entry_; |
| 443 Label exit_; | 439 Label exit_; |
| 444 Label* external_exit_; | 440 Label* external_exit_; |
| 445 int instruction_index_; | 441 int instruction_index_; |
| 446 }; | 442 }; |
| 447 | 443 |
| 448 } } // namespace v8::internal | 444 } } // namespace v8::internal |
| 449 | 445 |
| 450 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ | 446 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ |
| OLD | NEW |