| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 deoptimizations_(4, info->zone()), | 54 deoptimizations_(4, info->zone()), |
| 55 deopt_jump_table_(4, info->zone()), | 55 deopt_jump_table_(4, info->zone()), |
| 56 deoptimization_literals_(8, info->zone()), | 56 deoptimization_literals_(8, info->zone()), |
| 57 inlined_function_count_(0), | 57 inlined_function_count_(0), |
| 58 scope_(info->scope()), | 58 scope_(info->scope()), |
| 59 status_(UNUSED), | 59 status_(UNUSED), |
| 60 translations_(info->zone()), | 60 translations_(info->zone()), |
| 61 deferred_(8, info->zone()), | 61 deferred_(8, info->zone()), |
| 62 osr_pc_offset_(-1), | 62 osr_pc_offset_(-1), |
| 63 last_lazy_deopt_pc_(0), | 63 last_lazy_deopt_pc_(0), |
| 64 frame_is_built_(false), | |
| 65 safepoints_(info->zone()), | 64 safepoints_(info->zone()), |
| 66 resolver_(this), | 65 resolver_(this), |
| 67 expected_safepoint_kind_(Safepoint::kSimple) { | 66 expected_safepoint_kind_(Safepoint::kSimple) { |
| 68 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 67 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 69 } | 68 } |
| 70 | 69 |
| 71 | 70 |
| 72 // Simple accessors. | 71 // Simple accessors. |
| 73 MacroAssembler* masm() const { return masm_; } | 72 MacroAssembler* masm() const { return masm_; } |
| 74 CompilationInfo* info() const { return info_; } | 73 CompilationInfo* info() const { return info_; } |
| 75 Isolate* isolate() const { return info_->isolate(); } | 74 Isolate* isolate() const { return info_->isolate(); } |
| 76 Factory* factory() const { return isolate()->factory(); } | 75 Factory* factory() const { return isolate()->factory(); } |
| 77 Heap* heap() const { return isolate()->heap(); } | 76 Heap* heap() const { return isolate()->heap(); } |
| 78 Zone* zone() const { return zone_; } | 77 Zone* zone() const { return zone_; } |
| 79 | 78 |
| 80 bool NeedsEagerFrame() const { | |
| 81 return GetStackSlotCount() > 0 || | |
| 82 info()->is_non_deferred_calling() || | |
| 83 !info()->IsStub(); | |
| 84 } | |
| 85 bool NeedsDeferredFrame() const { | |
| 86 return !NeedsEagerFrame() && info()->is_deferred_calling(); | |
| 87 } | |
| 88 | |
| 89 // Support for converting LOperands to assembler types. | 79 // Support for converting LOperands to assembler types. |
| 90 // LOperand must be a register. | 80 // LOperand must be a register. |
| 91 Register ToRegister(LOperand* op) const; | 81 Register ToRegister(LOperand* op) const; |
| 92 | 82 |
| 93 // LOperand is loaded into scratch, unless already a register. | 83 // LOperand is loaded into scratch, unless already a register. |
| 94 Register EmitLoadRegister(LOperand* op, Register scratch); | 84 Register EmitLoadRegister(LOperand* op, Register scratch); |
| 95 | 85 |
| 96 // LOperand must be a double register. | 86 // LOperand must be a double register. |
| 97 DwVfpRegister ToDoubleRegister(LOperand* op) const; | 87 DoubleRegister ToDoubleRegister(LOperand* op) const; |
| 98 | 88 |
| 99 // LOperand is loaded into dbl_scratch, unless already a double register. | 89 // LOperand is loaded into dbl_scratch, unless already a double register. |
| 100 DwVfpRegister EmitLoadDoubleRegister(LOperand* op, | 90 DoubleRegister EmitLoadDoubleRegister(LOperand* op, |
| 101 SwVfpRegister flt_scratch, | 91 SwVfpRegister flt_scratch, |
| 102 DwVfpRegister dbl_scratch); | 92 DoubleRegister dbl_scratch); |
| 103 int ToInteger32(LConstantOperand* op) const; | 93 int ToInteger32(LConstantOperand* op) const; |
| 104 double ToDouble(LConstantOperand* op) const; | 94 double ToDouble(LConstantOperand* op) const; |
| 105 Operand ToOperand(LOperand* op); | 95 Operand ToOperand(LOperand* op); |
| 106 MemOperand ToMemOperand(LOperand* op) const; | 96 MemOperand ToMemOperand(LOperand* op) const; |
| 107 // Returns a MemOperand pointing to the high word of a DoubleStackSlot. | 97 // Returns a MemOperand pointing to the high word of a DoubleStackSlot. |
| 108 MemOperand ToHighMemOperand(LOperand* op) const; | 98 MemOperand ToHighMemOperand(LOperand* op) const; |
| 109 | 99 |
| 110 bool IsInteger32(LConstantOperand* op) const; | 100 bool IsInteger32(LConstantOperand* op) const; |
| 111 Handle<Object> ToHandle(LConstantOperand* op) const; | 101 Handle<Object> ToHandle(LConstantOperand* op) const; |
| 112 | 102 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 LInstruction* GetNextInstruction(); | 186 LInstruction* GetNextInstruction(); |
| 197 | 187 |
| 198 void EmitClassOfTest(Label* if_true, | 188 void EmitClassOfTest(Label* if_true, |
| 199 Label* if_false, | 189 Label* if_false, |
| 200 Handle<String> class_name, | 190 Handle<String> class_name, |
| 201 Register input, | 191 Register input, |
| 202 Register temporary, | 192 Register temporary, |
| 203 Register temporary2); | 193 Register temporary2); |
| 204 | 194 |
| 205 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 195 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
| 206 int GetParameterCount() const { return info()->num_parameters(); } | 196 int GetParameterCount() const { return scope()->num_parameters(); } |
| 207 | 197 |
| 208 void Abort(const char* reason); | 198 void Abort(const char* reason); |
| 209 void Comment(const char* format, ...); | 199 void Comment(const char* format, ...); |
| 210 | 200 |
| 211 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } | 201 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } |
| 212 | 202 |
| 213 // Code generation passes. Returns true if code generation should | 203 // Code generation passes. Returns true if code generation should |
| 214 // continue. | 204 // continue. |
| 215 bool GeneratePrologue(); | 205 bool GeneratePrologue(); |
| 216 bool GenerateBody(); | 206 bool GenerateBody(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 bool is_tagged, | 268 bool is_tagged, |
| 279 bool is_uint32, | 269 bool is_uint32, |
| 280 int arguments_index, | 270 int arguments_index, |
| 281 int arguments_count); | 271 int arguments_count); |
| 282 void PopulateDeoptimizationData(Handle<Code> code); | 272 void PopulateDeoptimizationData(Handle<Code> code); |
| 283 int DefineDeoptimizationLiteral(Handle<Object> literal); | 273 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 284 | 274 |
| 285 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 275 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 286 | 276 |
| 287 Register ToRegister(int index) const; | 277 Register ToRegister(int index) const; |
| 288 DwVfpRegister ToDoubleRegister(int index) const; | 278 DoubleRegister ToDoubleRegister(int index) const; |
| 289 | 279 |
| 290 // Specific math operations - used from DoUnaryMathOperation. | 280 // Specific math operations - used from DoUnaryMathOperation. |
| 291 void EmitIntegerMathAbs(LUnaryMathOperation* instr); | 281 void EmitIntegerMathAbs(LUnaryMathOperation* instr); |
| 292 void DoMathAbs(LUnaryMathOperation* instr); | 282 void DoMathAbs(LUnaryMathOperation* instr); |
| 293 void DoMathFloor(LUnaryMathOperation* instr); | 283 void DoMathFloor(LUnaryMathOperation* instr); |
| 294 void DoMathRound(LUnaryMathOperation* instr); | 284 void DoMathRound(LUnaryMathOperation* instr); |
| 295 void DoMathSqrt(LUnaryMathOperation* instr); | 285 void DoMathSqrt(LUnaryMathOperation* instr); |
| 296 void DoMathPowHalf(LUnaryMathOperation* instr); | 286 void DoMathPowHalf(LUnaryMathOperation* instr); |
| 297 void DoMathLog(LUnaryMathOperation* instr); | 287 void DoMathLog(LUnaryMathOperation* instr); |
| 298 void DoMathTan(LUnaryMathOperation* instr); | 288 void DoMathTan(LUnaryMathOperation* instr); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 311 Safepoint::DeoptMode mode); | 301 Safepoint::DeoptMode mode); |
| 312 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, | 302 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, |
| 313 int arguments, | 303 int arguments, |
| 314 Safepoint::DeoptMode mode); | 304 Safepoint::DeoptMode mode); |
| 315 void RecordPosition(int position); | 305 void RecordPosition(int position); |
| 316 | 306 |
| 317 static Condition TokenToCondition(Token::Value op, bool is_unsigned); | 307 static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
| 318 void EmitGoto(int block); | 308 void EmitGoto(int block); |
| 319 void EmitBranch(int left_block, int right_block, Condition cc); | 309 void EmitBranch(int left_block, int right_block, Condition cc); |
| 320 void EmitNumberUntagD(Register input, | 310 void EmitNumberUntagD(Register input, |
| 321 DwVfpRegister result, | 311 DoubleRegister result, |
| 322 bool deoptimize_on_undefined, | 312 bool deoptimize_on_undefined, |
| 323 bool deoptimize_on_minus_zero, | 313 bool deoptimize_on_minus_zero, |
| 324 LEnvironment* env); | 314 LEnvironment* env); |
| 325 | 315 |
| 326 void DeoptIfTaggedButNotSmi(LEnvironment* environment, | 316 void DeoptIfTaggedButNotSmi(LEnvironment* environment, |
| 327 HValue* value, | 317 HValue* value, |
| 328 LOperand* operand); | 318 LOperand* operand); |
| 329 | 319 |
| 330 // Emits optimized code for typeof x == "y". Modifies input register. | 320 // Emits optimized code for typeof x == "y". Modifies input register. |
| 331 // Returns the condition on which a final split to | 321 // Returns the condition on which a final split to |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // All registers are clobbered. | 362 // All registers are clobbered. |
| 373 // If 'remainder' is no_reg, it is not computed. | 363 // If 'remainder' is no_reg, it is not computed. |
| 374 void EmitSignedIntegerDivisionByConstant(Register result, | 364 void EmitSignedIntegerDivisionByConstant(Register result, |
| 375 Register dividend, | 365 Register dividend, |
| 376 int32_t divisor, | 366 int32_t divisor, |
| 377 Register remainder, | 367 Register remainder, |
| 378 Register scratch, | 368 Register scratch, |
| 379 LEnvironment* environment); | 369 LEnvironment* environment); |
| 380 | 370 |
| 381 struct JumpTableEntry { | 371 struct JumpTableEntry { |
| 382 inline JumpTableEntry(Address entry, bool frame, bool is_lazy) | 372 explicit inline JumpTableEntry(Address entry) |
| 383 : label(), | 373 : label(), |
| 384 address(entry), | 374 address(entry) { } |
| 385 needs_frame(frame), | |
| 386 is_lazy_deopt(is_lazy) { } | |
| 387 Label label; | 375 Label label; |
| 388 Address address; | 376 Address address; |
| 389 bool needs_frame; | |
| 390 bool is_lazy_deopt; | |
| 391 }; | 377 }; |
| 392 | 378 |
| 393 void EnsureSpaceForLazyDeopt(); | 379 void EnsureSpaceForLazyDeopt(); |
| 394 void DoLoadKeyedExternalArray(LLoadKeyed* instr); | 380 void DoLoadKeyedExternalArray(LLoadKeyed* instr); |
| 395 void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); | 381 void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); |
| 396 void DoLoadKeyedFixedArray(LLoadKeyed* instr); | 382 void DoLoadKeyedFixedArray(LLoadKeyed* instr); |
| 397 void DoStoreKeyedExternalArray(LStoreKeyed* instr); | 383 void DoStoreKeyedExternalArray(LStoreKeyed* instr); |
| 398 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); | 384 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); |
| 399 void DoStoreKeyedFixedArray(LStoreKeyed* instr); | 385 void DoStoreKeyedFixedArray(LStoreKeyed* instr); |
| 400 | 386 |
| 401 Zone* zone_; | 387 Zone* zone_; |
| 402 LPlatformChunk* const chunk_; | 388 LPlatformChunk* const chunk_; |
| 403 MacroAssembler* const masm_; | 389 MacroAssembler* const masm_; |
| 404 CompilationInfo* const info_; | 390 CompilationInfo* const info_; |
| 405 | 391 |
| 406 int current_block_; | 392 int current_block_; |
| 407 int current_instruction_; | 393 int current_instruction_; |
| 408 const ZoneList<LInstruction*>* instructions_; | 394 const ZoneList<LInstruction*>* instructions_; |
| 409 ZoneList<LEnvironment*> deoptimizations_; | 395 ZoneList<LEnvironment*> deoptimizations_; |
| 410 ZoneList<JumpTableEntry> deopt_jump_table_; | 396 ZoneList<JumpTableEntry> deopt_jump_table_; |
| 411 ZoneList<Handle<Object> > deoptimization_literals_; | 397 ZoneList<Handle<Object> > deoptimization_literals_; |
| 412 int inlined_function_count_; | 398 int inlined_function_count_; |
| 413 Scope* const scope_; | 399 Scope* const scope_; |
| 414 Status status_; | 400 Status status_; |
| 415 TranslationBuffer translations_; | 401 TranslationBuffer translations_; |
| 416 ZoneList<LDeferredCode*> deferred_; | 402 ZoneList<LDeferredCode*> deferred_; |
| 417 int osr_pc_offset_; | 403 int osr_pc_offset_; |
| 418 int last_lazy_deopt_pc_; | 404 int last_lazy_deopt_pc_; |
| 419 bool frame_is_built_; | |
| 420 | 405 |
| 421 // Builder that keeps track of safepoints in the code. The table | 406 // Builder that keeps track of safepoints in the code. The table |
| 422 // itself is emitted at the end of the generated code. | 407 // itself is emitted at the end of the generated code. |
| 423 SafepointTableBuilder safepoints_; | 408 SafepointTableBuilder safepoints_; |
| 424 | 409 |
| 425 // Compiler from a set of parallel moves to a sequential list of moves. | 410 // Compiler from a set of parallel moves to a sequential list of moves. |
| 426 LGapResolver resolver_; | 411 LGapResolver resolver_; |
| 427 | 412 |
| 428 Safepoint::Kind expected_safepoint_kind_; | 413 Safepoint::Kind expected_safepoint_kind_; |
| 429 | 414 |
| 430 class PushSafepointRegistersScope BASE_EMBEDDED { | 415 class PushSafepointRegistersScope BASE_EMBEDDED { |
| 431 public: | 416 public: |
| 432 PushSafepointRegistersScope(LCodeGen* codegen, | 417 PushSafepointRegistersScope(LCodeGen* codegen, |
| 433 Safepoint::Kind kind) | 418 Safepoint::Kind kind) |
| 434 : codegen_(codegen) { | 419 : codegen_(codegen) { |
| 435 ASSERT(codegen_->info()->is_calling()); | |
| 436 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 420 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 437 codegen_->expected_safepoint_kind_ = kind; | 421 codegen_->expected_safepoint_kind_ = kind; |
| 438 | 422 |
| 439 switch (codegen_->expected_safepoint_kind_) { | 423 switch (codegen_->expected_safepoint_kind_) { |
| 440 case Safepoint::kWithRegisters: | 424 case Safepoint::kWithRegisters: |
| 441 codegen_->masm_->PushSafepointRegisters(); | 425 codegen_->masm_->PushSafepointRegisters(); |
| 442 break; | 426 break; |
| 443 case Safepoint::kWithRegistersAndDoubles: | 427 case Safepoint::kWithRegistersAndDoubles: |
| 444 codegen_->masm_->PushSafepointRegistersAndDoubles(); | 428 codegen_->masm_->PushSafepointRegistersAndDoubles(); |
| 445 break; | 429 break; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 LCodeGen* codegen_; | 485 LCodeGen* codegen_; |
| 502 Label entry_; | 486 Label entry_; |
| 503 Label exit_; | 487 Label exit_; |
| 504 Label* external_exit_; | 488 Label* external_exit_; |
| 505 int instruction_index_; | 489 int instruction_index_; |
| 506 }; | 490 }; |
| 507 | 491 |
| 508 } } // namespace v8::internal | 492 } } // namespace v8::internal |
| 509 | 493 |
| 510 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ | 494 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ |
| OLD | NEW |