Chromium Code Reviews| 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 83 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, bool frame, bool is_lazy) |
|
Jakob Kummerow
2012/11/28 16:28:22
nit: no need for "explicit"
danno
2012/11/30 16:23:24
Done.
| |
| 373 : label(), | 383 : label(), |
| 374 address(entry) { } | 384 address(entry), |
| 385 needs_frame(frame), | |
| 386 is_lazy_deopt(is_lazy) { } | |
| 375 Label label; | 387 Label label; |
| 376 Address address; | 388 Address address; |
| 389 bool needs_frame; | |
| 390 bool is_lazy_deopt; | |
| 377 }; | 391 }; |
| 378 | 392 |
| 379 void EnsureSpaceForLazyDeopt(); | 393 void EnsureSpaceForLazyDeopt(); |
| 380 void DoLoadKeyedExternalArray(LLoadKeyed* instr); | 394 void DoLoadKeyedExternalArray(LLoadKeyed* instr); |
| 381 void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); | 395 void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); |
| 382 void DoLoadKeyedFixedArray(LLoadKeyed* instr); | 396 void DoLoadKeyedFixedArray(LLoadKeyed* instr); |
| 383 void DoStoreKeyedExternalArray(LStoreKeyed* instr); | 397 void DoStoreKeyedExternalArray(LStoreKeyed* instr); |
| 384 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); | 398 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); |
| 385 void DoStoreKeyedFixedArray(LStoreKeyed* instr); | 399 void DoStoreKeyedFixedArray(LStoreKeyed* instr); |
| 386 | 400 |
| 387 Zone* zone_; | 401 Zone* zone_; |
| 388 LPlatformChunk* const chunk_; | 402 LPlatformChunk* const chunk_; |
| 389 MacroAssembler* const masm_; | 403 MacroAssembler* const masm_; |
| 390 CompilationInfo* const info_; | 404 CompilationInfo* const info_; |
| 391 | 405 |
| 392 int current_block_; | 406 int current_block_; |
| 393 int current_instruction_; | 407 int current_instruction_; |
| 394 const ZoneList<LInstruction*>* instructions_; | 408 const ZoneList<LInstruction*>* instructions_; |
| 395 ZoneList<LEnvironment*> deoptimizations_; | 409 ZoneList<LEnvironment*> deoptimizations_; |
| 396 ZoneList<JumpTableEntry> deopt_jump_table_; | 410 ZoneList<JumpTableEntry> deopt_jump_table_; |
| 397 ZoneList<Handle<Object> > deoptimization_literals_; | 411 ZoneList<Handle<Object> > deoptimization_literals_; |
| 398 int inlined_function_count_; | 412 int inlined_function_count_; |
| 399 Scope* const scope_; | 413 Scope* const scope_; |
| 400 Status status_; | 414 Status status_; |
| 401 TranslationBuffer translations_; | 415 TranslationBuffer translations_; |
| 402 ZoneList<LDeferredCode*> deferred_; | 416 ZoneList<LDeferredCode*> deferred_; |
| 403 int osr_pc_offset_; | 417 int osr_pc_offset_; |
| 404 int last_lazy_deopt_pc_; | 418 int last_lazy_deopt_pc_; |
| 419 bool frame_is_built_; | |
| 405 | 420 |
| 406 // Builder that keeps track of safepoints in the code. The table | 421 // Builder that keeps track of safepoints in the code. The table |
| 407 // itself is emitted at the end of the generated code. | 422 // itself is emitted at the end of the generated code. |
| 408 SafepointTableBuilder safepoints_; | 423 SafepointTableBuilder safepoints_; |
| 409 | 424 |
| 410 // Compiler from a set of parallel moves to a sequential list of moves. | 425 // Compiler from a set of parallel moves to a sequential list of moves. |
| 411 LGapResolver resolver_; | 426 LGapResolver resolver_; |
| 412 | 427 |
| 413 Safepoint::Kind expected_safepoint_kind_; | 428 Safepoint::Kind expected_safepoint_kind_; |
| 414 | 429 |
| 415 class PushSafepointRegistersScope BASE_EMBEDDED { | 430 class PushSafepointRegistersScope BASE_EMBEDDED { |
| 416 public: | 431 public: |
| 417 PushSafepointRegistersScope(LCodeGen* codegen, | 432 PushSafepointRegistersScope(LCodeGen* codegen, |
| 418 Safepoint::Kind kind) | 433 Safepoint::Kind kind) |
| 419 : codegen_(codegen) { | 434 : codegen_(codegen) { |
| 435 ASSERT(codegen_->info()->is_calling()); | |
| 420 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 436 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 421 codegen_->expected_safepoint_kind_ = kind; | 437 codegen_->expected_safepoint_kind_ = kind; |
| 422 | 438 |
| 423 switch (codegen_->expected_safepoint_kind_) { | 439 switch (codegen_->expected_safepoint_kind_) { |
| 424 case Safepoint::kWithRegisters: | 440 case Safepoint::kWithRegisters: |
| 425 codegen_->masm_->PushSafepointRegisters(); | 441 codegen_->masm_->PushSafepointRegisters(); |
| 426 break; | 442 break; |
| 427 case Safepoint::kWithRegistersAndDoubles: | 443 case Safepoint::kWithRegistersAndDoubles: |
| 428 codegen_->masm_->PushSafepointRegistersAndDoubles(); | 444 codegen_->masm_->PushSafepointRegistersAndDoubles(); |
| 429 break; | 445 break; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 LCodeGen* codegen_; | 501 LCodeGen* codegen_; |
| 486 Label entry_; | 502 Label entry_; |
| 487 Label exit_; | 503 Label exit_; |
| 488 Label* external_exit_; | 504 Label* external_exit_; |
| 489 int instruction_index_; | 505 int instruction_index_; |
| 490 }; | 506 }; |
| 491 | 507 |
| 492 } } // namespace v8::internal | 508 } } // namespace v8::internal |
| 493 | 509 |
| 494 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ | 510 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ |
| OLD | NEW |