| 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 25 matching lines...) Expand all Loading... |
| 36 #include "scopes.h" | 36 #include "scopes.h" |
| 37 #include "v8utils.h" | 37 #include "v8utils.h" |
| 38 | 38 |
| 39 namespace v8 { | 39 namespace v8 { |
| 40 namespace internal { | 40 namespace internal { |
| 41 | 41 |
| 42 // Forward declarations. | 42 // Forward declarations. |
| 43 class LDeferredCode; | 43 class LDeferredCode; |
| 44 class SafepointGenerator; | 44 class SafepointGenerator; |
| 45 | 45 |
| 46 class LCodeGen BASE_EMBEDDED { | 46 class LCodeGen V8_FINAL BASE_EMBEDDED { |
| 47 public: | 47 public: |
| 48 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) | 48 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) |
| 49 : zone_(info->zone()), | 49 : zone_(info->zone()), |
| 50 chunk_(static_cast<LPlatformChunk*>(chunk)), | 50 chunk_(static_cast<LPlatformChunk*>(chunk)), |
| 51 masm_(assembler), | 51 masm_(assembler), |
| 52 info_(info), | 52 info_(info), |
| 53 current_block_(-1), | 53 current_block_(-1), |
| 54 current_instruction_(-1), | 54 current_instruction_(-1), |
| 55 instructions_(chunk->instructions()), | 55 instructions_(chunk->instructions()), |
| 56 deoptimizations_(4, info->zone()), | 56 deoptimizations_(4, info->zone()), |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 CallKind call_kind, | 274 CallKind call_kind, |
| 275 R1State r1_state); | 275 R1State r1_state); |
| 276 | 276 |
| 277 void LoadHeapObject(Register result, Handle<HeapObject> object); | 277 void LoadHeapObject(Register result, Handle<HeapObject> object); |
| 278 | 278 |
| 279 void RecordSafepointWithLazyDeopt(LInstruction* instr, | 279 void RecordSafepointWithLazyDeopt(LInstruction* instr, |
| 280 SafepointMode safepoint_mode); | 280 SafepointMode safepoint_mode); |
| 281 | 281 |
| 282 void RegisterEnvironmentForDeoptimization(LEnvironment* environment, | 282 void RegisterEnvironmentForDeoptimization(LEnvironment* environment, |
| 283 Safepoint::DeoptMode mode); | 283 Safepoint::DeoptMode mode); |
| 284 void DeoptimizeIf(Condition cc, | 284 void DeoptimizeIf(Condition condition, |
| 285 LEnvironment* environment, | 285 LEnvironment* environment, |
| 286 Deoptimizer::BailoutType bailout_type); | 286 Deoptimizer::BailoutType bailout_type); |
| 287 void DeoptimizeIf(Condition cc, LEnvironment* environment); | 287 void DeoptimizeIf(Condition condition, LEnvironment* environment); |
| 288 void ApplyCheckIf(Condition cc, LBoundsCheck* check); | 288 void ApplyCheckIf(Condition condition, LBoundsCheck* check); |
| 289 | 289 |
| 290 void AddToTranslation(LEnvironment* environment, | 290 void AddToTranslation(LEnvironment* environment, |
| 291 Translation* translation, | 291 Translation* translation, |
| 292 LOperand* op, | 292 LOperand* op, |
| 293 bool is_tagged, | 293 bool is_tagged, |
| 294 bool is_uint32, | 294 bool is_uint32, |
| 295 int* object_index_pointer, | 295 int* object_index_pointer, |
| 296 int* dematerialized_index_pointer); | 296 int* dematerialized_index_pointer); |
| 297 void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code); | 297 void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code); |
| 298 void PopulateDeoptimizationData(Handle<Code> code); | 298 void PopulateDeoptimizationData(Handle<Code> code); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 317 Safepoint::DeoptMode mode); | 317 Safepoint::DeoptMode mode); |
| 318 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, | 318 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, |
| 319 int arguments, | 319 int arguments, |
| 320 Safepoint::DeoptMode mode); | 320 Safepoint::DeoptMode mode); |
| 321 void RecordPosition(int position); | 321 void RecordPosition(int position); |
| 322 void RecordAndUpdatePosition(int position); | 322 void RecordAndUpdatePosition(int position); |
| 323 | 323 |
| 324 static Condition TokenToCondition(Token::Value op, bool is_unsigned); | 324 static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
| 325 void EmitGoto(int block); | 325 void EmitGoto(int block); |
| 326 template<class InstrType> | 326 template<class InstrType> |
| 327 void EmitBranch(InstrType instr, Condition cc); | 327 void EmitBranch(InstrType instr, Condition condition); |
| 328 template<class InstrType> |
| 329 void EmitFalseBranch(InstrType instr, Condition condition); |
| 328 void EmitNumberUntagD(Register input, | 330 void EmitNumberUntagD(Register input, |
| 329 DwVfpRegister result, | 331 DwVfpRegister result, |
| 330 bool allow_undefined_as_nan, | 332 bool allow_undefined_as_nan, |
| 331 bool deoptimize_on_minus_zero, | 333 bool deoptimize_on_minus_zero, |
| 332 LEnvironment* env, | 334 LEnvironment* env, |
| 333 NumberUntagDMode mode); | 335 NumberUntagDMode mode); |
| 334 | 336 |
| 335 // Emits optimized code for typeof x == "y". Modifies input register. | 337 // Emits optimized code for typeof x == "y". Modifies input register. |
| 336 // Returns the condition on which a final split to | 338 // Returns the condition on which a final split to |
| 337 // true and false label should be made, to optimize fallthrough. | 339 // true and false label should be made, to optimize fallthrough. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 353 // true and false label should be made, to optimize fallthrough. | 355 // true and false label should be made, to optimize fallthrough. |
| 354 Condition EmitIsString(Register input, | 356 Condition EmitIsString(Register input, |
| 355 Register temp1, | 357 Register temp1, |
| 356 Label* is_not_string, | 358 Label* is_not_string, |
| 357 SmiCheck check_needed); | 359 SmiCheck check_needed); |
| 358 | 360 |
| 359 // Emits optimized code for %_IsConstructCall(). | 361 // Emits optimized code for %_IsConstructCall(). |
| 360 // Caller should branch on equal condition. | 362 // Caller should branch on equal condition. |
| 361 void EmitIsConstructCall(Register temp1, Register temp2); | 363 void EmitIsConstructCall(Register temp1, Register temp2); |
| 362 | 364 |
| 363 void EmitLoadFieldOrConstantFunction(Register result, | |
| 364 Register object, | |
| 365 Handle<Map> type, | |
| 366 Handle<String> name, | |
| 367 LEnvironment* env); | |
| 368 | |
| 369 // Emits optimized code to deep-copy the contents of statically known | 365 // Emits optimized code to deep-copy the contents of statically known |
| 370 // object graphs (e.g. object literal boilerplate). | 366 // object graphs (e.g. object literal boilerplate). |
| 371 void EmitDeepCopy(Handle<JSObject> object, | 367 void EmitDeepCopy(Handle<JSObject> object, |
| 372 Register result, | 368 Register result, |
| 373 Register source, | 369 Register source, |
| 374 int* offset, | 370 int* offset, |
| 375 AllocationSiteMode mode); | 371 AllocationSiteMode mode); |
| 376 | 372 |
| 377 // Emit optimized code for integer division. | 373 // Emit optimized code for integer division. |
| 378 // Inputs are signed. | 374 // Inputs are signed. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 // itself is emitted at the end of the generated code. | 413 // itself is emitted at the end of the generated code. |
| 418 SafepointTableBuilder safepoints_; | 414 SafepointTableBuilder safepoints_; |
| 419 | 415 |
| 420 // Compiler from a set of parallel moves to a sequential list of moves. | 416 // Compiler from a set of parallel moves to a sequential list of moves. |
| 421 LGapResolver resolver_; | 417 LGapResolver resolver_; |
| 422 | 418 |
| 423 Safepoint::Kind expected_safepoint_kind_; | 419 Safepoint::Kind expected_safepoint_kind_; |
| 424 | 420 |
| 425 int old_position_; | 421 int old_position_; |
| 426 | 422 |
| 427 class PushSafepointRegistersScope BASE_EMBEDDED { | 423 class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED { |
| 428 public: | 424 public: |
| 429 PushSafepointRegistersScope(LCodeGen* codegen, | 425 PushSafepointRegistersScope(LCodeGen* codegen, |
| 430 Safepoint::Kind kind) | 426 Safepoint::Kind kind) |
| 431 : codegen_(codegen) { | 427 : codegen_(codegen) { |
| 432 ASSERT(codegen_->info()->is_calling()); | 428 ASSERT(codegen_->info()->is_calling()); |
| 433 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 429 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 434 codegen_->expected_safepoint_kind_ = kind; | 430 codegen_->expected_safepoint_kind_ = kind; |
| 435 | 431 |
| 436 switch (codegen_->expected_safepoint_kind_) { | 432 switch (codegen_->expected_safepoint_kind_) { |
| 437 case Safepoint::kWithRegisters: | 433 case Safepoint::kWithRegisters: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 465 LCodeGen* codegen_; | 461 LCodeGen* codegen_; |
| 466 }; | 462 }; |
| 467 | 463 |
| 468 friend class LDeferredCode; | 464 friend class LDeferredCode; |
| 469 friend class LEnvironment; | 465 friend class LEnvironment; |
| 470 friend class SafepointGenerator; | 466 friend class SafepointGenerator; |
| 471 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 467 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
| 472 }; | 468 }; |
| 473 | 469 |
| 474 | 470 |
| 475 class LDeferredCode: public ZoneObject { | 471 class LDeferredCode : public ZoneObject { |
| 476 public: | 472 public: |
| 477 explicit LDeferredCode(LCodeGen* codegen) | 473 explicit LDeferredCode(LCodeGen* codegen) |
| 478 : codegen_(codegen), | 474 : codegen_(codegen), |
| 479 external_exit_(NULL), | 475 external_exit_(NULL), |
| 480 instruction_index_(codegen->current_instruction_) { | 476 instruction_index_(codegen->current_instruction_) { |
| 481 codegen->AddDeferredCode(this); | 477 codegen->AddDeferredCode(this); |
| 482 } | 478 } |
| 483 | 479 |
| 484 virtual ~LDeferredCode() { } | 480 virtual ~LDeferredCode() {} |
| 485 virtual void Generate() = 0; | 481 virtual void Generate() = 0; |
| 486 virtual LInstruction* instr() = 0; | 482 virtual LInstruction* instr() = 0; |
| 487 | 483 |
| 488 void SetExit(Label* exit) { external_exit_ = exit; } | 484 void SetExit(Label* exit) { external_exit_ = exit; } |
| 489 Label* entry() { return &entry_; } | 485 Label* entry() { return &entry_; } |
| 490 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } | 486 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } |
| 491 int instruction_index() const { return instruction_index_; } | 487 int instruction_index() const { return instruction_index_; } |
| 492 | 488 |
| 493 protected: | 489 protected: |
| 494 LCodeGen* codegen() const { return codegen_; } | 490 LCodeGen* codegen() const { return codegen_; } |
| 495 MacroAssembler* masm() const { return codegen_->masm(); } | 491 MacroAssembler* masm() const { return codegen_->masm(); } |
| 496 | 492 |
| 497 private: | 493 private: |
| 498 LCodeGen* codegen_; | 494 LCodeGen* codegen_; |
| 499 Label entry_; | 495 Label entry_; |
| 500 Label exit_; | 496 Label exit_; |
| 501 Label* external_exit_; | 497 Label* external_exit_; |
| 502 int instruction_index_; | 498 int instruction_index_; |
| 503 }; | 499 }; |
| 504 | 500 |
| 505 } } // namespace v8::internal | 501 } } // namespace v8::internal |
| 506 | 502 |
| 507 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ | 503 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ |
| OLD | NEW |