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