OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // Accessors | 350 // Accessors |
351 inline bool is_eval(); | 351 inline bool is_eval(); |
352 inline Scope* scope(); | 352 inline Scope* scope(); |
353 | 353 |
354 // Generating deferred code. | 354 // Generating deferred code. |
355 void ProcessDeferred(); | 355 void ProcessDeferred(); |
356 | 356 |
357 // State | 357 // State |
358 ControlDestination* destination() const { return state_->destination(); } | 358 ControlDestination* destination() const { return state_->destination(); } |
359 | 359 |
| 360 // Control of side-effect-free int32 expression compilation. |
| 361 bool in_safe_int32_mode() { return in_safe_int32_mode_; } |
| 362 void set_in_safe_int32_mode(bool value) { in_safe_int32_mode_ = value; } |
| 363 bool safe_int32_mode_enabled() { |
| 364 return FLAG_safe_int32_compiler && safe_int32_mode_enabled_; |
| 365 } |
| 366 void set_safe_int32_mode_enabled(bool value) { |
| 367 safe_int32_mode_enabled_ = value; |
| 368 } |
| 369 void set_unsafe_bailout(BreakTarget* unsafe_bailout) { |
| 370 unsafe_bailout_ = unsafe_bailout; |
| 371 } |
| 372 |
| 373 // Take the Result that is an untagged int32, and convert it to a tagged |
| 374 // Smi or HeapNumber. Remove the untagged_int32 flag from the result. |
| 375 void ConvertInt32ResultToNumber(Result* value); |
| 376 |
360 // Track loop nesting level. | 377 // Track loop nesting level. |
361 int loop_nesting() const { return loop_nesting_; } | 378 int loop_nesting() const { return loop_nesting_; } |
362 void IncrementLoopNesting() { loop_nesting_++; } | 379 void IncrementLoopNesting() { loop_nesting_++; } |
363 void DecrementLoopNesting() { loop_nesting_--; } | 380 void DecrementLoopNesting() { loop_nesting_--; } |
364 | 381 |
365 // Node visitors. | 382 // Node visitors. |
366 void VisitStatements(ZoneList<Statement*>* statements); | 383 void VisitStatements(ZoneList<Statement*>* statements); |
367 | 384 |
368 #define DEF_VISIT(type) \ | 385 #define DEF_VISIT(type) \ |
369 void Visit##type(type* node); | 386 void Visit##type(type* node); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 423 |
407 Operand ContextSlotOperandCheckExtensions(Slot* slot, | 424 Operand ContextSlotOperandCheckExtensions(Slot* slot, |
408 Result tmp, | 425 Result tmp, |
409 JumpTarget* slow); | 426 JumpTarget* slow); |
410 | 427 |
411 // Expressions | 428 // Expressions |
412 static Operand GlobalObject() { | 429 static Operand GlobalObject() { |
413 return ContextOperand(esi, Context::GLOBAL_INDEX); | 430 return ContextOperand(esi, Context::GLOBAL_INDEX); |
414 } | 431 } |
415 | 432 |
416 void LoadCondition(Expression* x, | 433 void LoadCondition(Expression* expr, |
417 ControlDestination* destination, | 434 ControlDestination* destination, |
418 bool force_control); | 435 bool force_control); |
419 void Load(Expression* expr); | 436 void Load(Expression* expr); |
420 void LoadGlobal(); | 437 void LoadGlobal(); |
421 void LoadGlobalReceiver(); | 438 void LoadGlobalReceiver(); |
422 | 439 |
423 // Generate code to push the value of an expression on top of the frame | 440 // Generate code to push the value of an expression on top of the frame |
424 // and then spill the frame fully to memory. This function is used | 441 // and then spill the frame fully to memory. This function is used |
425 // temporarily while the code generator is being transformed. | 442 // temporarily while the code generator is being transformed. |
426 void LoadAndSpill(Expression* expression); | 443 void LoadAndSpill(Expression* expression); |
427 | 444 |
| 445 // Evaluate an expression and place its value on top of the frame, |
| 446 // using, or not using, the side-effect-free expression compiler. |
| 447 void LoadInSafeInt32Mode(Expression* expr, BreakTarget* unsafe_bailout); |
| 448 void LoadWithSafeInt32ModeDisabled(Expression* expr); |
| 449 |
428 // Read a value from a slot and leave it on top of the expression stack. | 450 // Read a value from a slot and leave it on top of the expression stack. |
429 Result LoadFromSlot(Slot* slot, TypeofState typeof_state); | 451 Result LoadFromSlot(Slot* slot, TypeofState typeof_state); |
430 Result LoadFromSlotCheckForArguments(Slot* slot, TypeofState typeof_state); | 452 Result LoadFromSlotCheckForArguments(Slot* slot, TypeofState typeof_state); |
431 Result LoadFromGlobalSlotCheckExtensions(Slot* slot, | 453 Result LoadFromGlobalSlotCheckExtensions(Slot* slot, |
432 TypeofState typeof_state, | 454 TypeofState typeof_state, |
433 JumpTarget* slow); | 455 JumpTarget* slow); |
434 | 456 |
435 // Store the value on top of the expression stack into a slot, leaving the | 457 // Store the value on top of the expression stack into a slot, leaving the |
436 // value in place. | 458 // value in place. |
437 void StoreToSlot(Slot* slot, InitState init_state); | 459 void StoreToSlot(Slot* slot, InitState init_state); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 511 |
490 // Emit code to perform a binary operation on two likely smis. | 512 // Emit code to perform a binary operation on two likely smis. |
491 // The code to handle smi arguments is produced inline. | 513 // The code to handle smi arguments is produced inline. |
492 // Consumes the Results *left and *right. | 514 // Consumes the Results *left and *right. |
493 Result LikelySmiBinaryOperation(Token::Value op, | 515 Result LikelySmiBinaryOperation(Token::Value op, |
494 Result* left, | 516 Result* left, |
495 Result* right, | 517 Result* right, |
496 OverwriteMode overwrite_mode, | 518 OverwriteMode overwrite_mode, |
497 bool no_negative_zero); | 519 bool no_negative_zero); |
498 | 520 |
| 521 |
| 522 // Emit code to perform a binary operation on two untagged int32 values. |
| 523 // The values are on top of the frame, and the result is pushed on the frame. |
| 524 void Int32BinaryOperation(BinaryOperation* node); |
| 525 |
| 526 |
499 void Comparison(AstNode* node, | 527 void Comparison(AstNode* node, |
500 Condition cc, | 528 Condition cc, |
501 bool strict, | 529 bool strict, |
502 ControlDestination* destination); | 530 ControlDestination* destination); |
503 | 531 |
504 // To prevent long attacker-controlled byte sequences, integer constants | 532 // To prevent long attacker-controlled byte sequences, integer constants |
505 // from the JavaScript source are loaded in two parts if they are larger | 533 // from the JavaScript source are loaded in two parts if they are larger |
506 // than 17 bits. | 534 // than 17 bits. |
507 static const int kMaxSmiInlinedBits = 17; | 535 static const int kMaxSmiInlinedBits = 17; |
508 bool IsUnsafeSmi(Handle<Object> value); | 536 bool IsUnsafeSmi(Handle<Object> value); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 // Assembler | 663 // Assembler |
636 MacroAssembler* masm_; // to generate code | 664 MacroAssembler* masm_; // to generate code |
637 | 665 |
638 CompilationInfo* info_; | 666 CompilationInfo* info_; |
639 | 667 |
640 // Code generation state | 668 // Code generation state |
641 VirtualFrame* frame_; | 669 VirtualFrame* frame_; |
642 RegisterAllocator* allocator_; | 670 RegisterAllocator* allocator_; |
643 CodeGenState* state_; | 671 CodeGenState* state_; |
644 int loop_nesting_; | 672 int loop_nesting_; |
| 673 bool in_safe_int32_mode_; |
| 674 bool safe_int32_mode_enabled_; |
645 | 675 |
646 // Jump targets. | 676 // Jump targets. |
647 // The target of the return from the function. | 677 // The target of the return from the function. |
648 BreakTarget function_return_; | 678 BreakTarget function_return_; |
| 679 // The target of the bailout from a side-effect-free int32 subexpression. |
| 680 BreakTarget* unsafe_bailout_; |
649 | 681 |
650 // True if the function return is shadowed (ie, jumping to the target | 682 // True if the function return is shadowed (ie, jumping to the target |
651 // function_return_ does not jump to the true function return, but rather | 683 // function_return_ does not jump to the true function return, but rather |
652 // to some unlinking code). | 684 // to some unlinking code). |
653 bool function_return_is_shadowed_; | 685 bool function_return_is_shadowed_; |
654 | 686 |
655 // True when we are in code that expects the virtual frame to be fully | 687 // True when we are in code that expects the virtual frame to be fully |
656 // spilled. Some virtual frame function are disabled in DEBUG builds when | 688 // spilled. Some virtual frame function are disabled in DEBUG builds when |
657 // called from spilled code, because they do not leave the virtual frame | 689 // called from spilled code, because they do not leave the virtual frame |
658 // in a spilled state. | 690 // in a spilled state. |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 return ObjectBits::encode(object_.code()) | | 1044 return ObjectBits::encode(object_.code()) | |
1013 AddressBits::encode(addr_.code()) | | 1045 AddressBits::encode(addr_.code()) | |
1014 ScratchBits::encode(scratch_.code()); | 1046 ScratchBits::encode(scratch_.code()); |
1015 } | 1047 } |
1016 }; | 1048 }; |
1017 | 1049 |
1018 | 1050 |
1019 } } // namespace v8::internal | 1051 } } // namespace v8::internal |
1020 | 1052 |
1021 #endif // V8_IA32_CODEGEN_IA32_H_ | 1053 #endif // V8_IA32_CODEGEN_IA32_H_ |
OLD | NEW |