Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1320 // Use the shared code stub to call the function. | 1320 // Use the shared code stub to call the function. |
| 1321 CallFunctionStub call_function(arg_count); | 1321 CallFunctionStub call_function(arg_count); |
| 1322 Result answer = frame_->CallStub(&call_function, arg_count + 1); | 1322 Result answer = frame_->CallStub(&call_function, arg_count + 1); |
| 1323 // Restore context and replace function on the stack with the | 1323 // Restore context and replace function on the stack with the |
| 1324 // result of the stub invocation. | 1324 // result of the stub invocation. |
| 1325 frame_->RestoreContextRegister(); | 1325 frame_->RestoreContextRegister(); |
| 1326 frame_->SetElementAt(0, &answer); | 1326 frame_->SetElementAt(0, &answer); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 | 1329 |
| 1330 class DeferredStackCheck: public DeferredCode { | |
| 1331 public: | |
| 1332 DeferredStackCheck(CodeGenerator* generator) | |
| 1333 : DeferredCode(generator) { | |
| 1334 set_comment("[ DeferredStackCheck"); | |
| 1335 } | |
| 1336 | |
| 1337 virtual void Generate(); | |
| 1338 }; | |
| 1339 | |
| 1340 | |
| 1341 void DeferredStackCheck::Generate() { | |
| 1342 StackCheckStub stub; | |
|
Kasper Lund
2009/01/22 14:04:46
Maybe move this to just before it's used (CallStub
Kevin Millikin (Chromium)
2009/01/22 14:07:50
NP.
| |
| 1343 enter()->Bind(); | |
| 1344 // The stack check can trigger the debugger. Before calling it, all | |
| 1345 // values including constants must be spilled to the frame. | |
| 1346 generator()->frame()->SpillAll(); | |
| 1347 Result ignored = generator()->frame()->CallStub(&stub, 0); | |
| 1348 exit()->Jump(); | |
| 1349 } | |
| 1350 | |
| 1351 | |
| 1330 void CodeGenerator::CheckStack() { | 1352 void CodeGenerator::CheckStack() { |
| 1331 if (FLAG_check_stack) { | 1353 if (FLAG_check_stack) { |
| 1332 JumpTarget stack_is_ok(this); | 1354 DeferredStackCheck* deferred = new DeferredStackCheck(this); |
| 1333 StackCheckStub stub; | |
| 1334 ExternalReference stack_guard_limit = | 1355 ExternalReference stack_guard_limit = |
| 1335 ExternalReference::address_of_stack_guard_limit(); | 1356 ExternalReference::address_of_stack_guard_limit(); |
| 1336 __ cmp(esp, Operand::StaticVariable(stack_guard_limit)); | 1357 __ cmp(esp, Operand::StaticVariable(stack_guard_limit)); |
| 1337 stack_is_ok.Branch(above_equal, taken); | 1358 deferred->enter()->Branch(below, not_taken); |
| 1338 // The stack check can trigger the debugger. Before calling it, all | 1359 deferred->exit()->Bind(); |
| 1339 // values including constants must be spilled to the frame. | |
| 1340 frame_->SpillAll(); | |
| 1341 frame_->CallStub(&stub, 0); | |
| 1342 stack_is_ok.Bind(); | |
| 1343 } | 1360 } |
| 1344 } | 1361 } |
| 1345 | 1362 |
| 1346 | 1363 |
| 1347 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) { | 1364 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) { |
| 1348 ASSERT(!in_spilled_code()); | 1365 ASSERT(!in_spilled_code()); |
| 1349 for (int i = 0; has_valid_frame() && i < statements->length(); i++) { | 1366 for (int i = 0; has_valid_frame() && i < statements->length(); i++) { |
| 1350 Visit(statements->at(i)); | 1367 Visit(statements->at(i)); |
| 1351 } | 1368 } |
| 1352 } | 1369 } |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2758 } else { | 2775 } else { |
| 2759 frame_->Push(node->handle()); | 2776 frame_->Push(node->handle()); |
| 2760 } | 2777 } |
| 2761 } | 2778 } |
| 2762 | 2779 |
| 2763 | 2780 |
| 2764 class DeferredRegExpLiteral: public DeferredCode { | 2781 class DeferredRegExpLiteral: public DeferredCode { |
| 2765 public: | 2782 public: |
| 2766 DeferredRegExpLiteral(CodeGenerator* generator, RegExpLiteral* node) | 2783 DeferredRegExpLiteral(CodeGenerator* generator, RegExpLiteral* node) |
| 2767 : DeferredCode(generator), node_(node) { | 2784 : DeferredCode(generator), node_(node) { |
| 2768 set_comment("[ RegExpDeferred"); | 2785 set_comment("[ DeferredRegExpLiteral"); |
| 2769 } | 2786 } |
| 2770 virtual void Generate(); | 2787 virtual void Generate(); |
| 2771 private: | 2788 private: |
| 2772 RegExpLiteral* node_; | 2789 RegExpLiteral* node_; |
| 2773 }; | 2790 }; |
| 2774 | 2791 |
| 2775 | 2792 |
| 2776 void DeferredRegExpLiteral::Generate() { | 2793 void DeferredRegExpLiteral::Generate() { |
| 2777 // The argument is actually passed in ecx. | 2794 // The argument is actually passed in ecx. |
| 2778 enter()->Bind(); | 2795 enter()->Bind(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2827 | 2844 |
| 2828 // This deferred code stub will be used for creating the boilerplate | 2845 // This deferred code stub will be used for creating the boilerplate |
| 2829 // by calling Runtime_CreateObjectLiteral. | 2846 // by calling Runtime_CreateObjectLiteral. |
| 2830 // Each created boilerplate is stored in the JSFunction and they are | 2847 // Each created boilerplate is stored in the JSFunction and they are |
| 2831 // therefore context dependent. | 2848 // therefore context dependent. |
| 2832 class DeferredObjectLiteral: public DeferredCode { | 2849 class DeferredObjectLiteral: public DeferredCode { |
| 2833 public: | 2850 public: |
| 2834 DeferredObjectLiteral(CodeGenerator* generator, | 2851 DeferredObjectLiteral(CodeGenerator* generator, |
| 2835 ObjectLiteral* node) | 2852 ObjectLiteral* node) |
| 2836 : DeferredCode(generator), node_(node) { | 2853 : DeferredCode(generator), node_(node) { |
| 2837 set_comment("[ ObjectLiteralDeferred"); | 2854 set_comment("[ DeferredObjectLiteral"); |
| 2838 } | 2855 } |
| 2839 virtual void Generate(); | 2856 virtual void Generate(); |
| 2840 private: | 2857 private: |
| 2841 ObjectLiteral* node_; | 2858 ObjectLiteral* node_; |
| 2842 }; | 2859 }; |
| 2843 | 2860 |
| 2844 | 2861 |
| 2845 void DeferredObjectLiteral::Generate() { | 2862 void DeferredObjectLiteral::Generate() { |
| 2846 // The argument is actually passed in ecx. | 2863 // The argument is actually passed in ecx. |
| 2847 enter()->Bind(); | 2864 enter()->Bind(); |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3764 class DeferredCountOperation: public DeferredCode { | 3781 class DeferredCountOperation: public DeferredCode { |
| 3765 public: | 3782 public: |
| 3766 DeferredCountOperation(CodeGenerator* generator, | 3783 DeferredCountOperation(CodeGenerator* generator, |
| 3767 bool is_postfix, | 3784 bool is_postfix, |
| 3768 bool is_increment, | 3785 bool is_increment, |
| 3769 int result_offset) | 3786 int result_offset) |
| 3770 : DeferredCode(generator), | 3787 : DeferredCode(generator), |
| 3771 is_postfix_(is_postfix), | 3788 is_postfix_(is_postfix), |
| 3772 is_increment_(is_increment), | 3789 is_increment_(is_increment), |
| 3773 result_offset_(result_offset) { | 3790 result_offset_(result_offset) { |
| 3774 set_comment("[ CountOperationDeferred"); | 3791 set_comment("[ DeferredCountOperation"); |
| 3775 } | 3792 } |
| 3776 | 3793 |
| 3777 virtual void Generate(); | 3794 virtual void Generate(); |
| 3778 | 3795 |
| 3779 private: | 3796 private: |
| 3780 bool is_postfix_; | 3797 bool is_postfix_; |
| 3781 bool is_increment_; | 3798 bool is_increment_; |
| 3782 int result_offset_; | 3799 int result_offset_; |
| 3783 }; | 3800 }; |
| 3784 | 3801 |
| (...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6109 | 6126 |
| 6110 // Slow-case: Go through the JavaScript implementation. | 6127 // Slow-case: Go through the JavaScript implementation. |
| 6111 __ bind(&slow); | 6128 __ bind(&slow); |
| 6112 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6129 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 6113 } | 6130 } |
| 6114 | 6131 |
| 6115 | 6132 |
| 6116 #undef __ | 6133 #undef __ |
| 6117 | 6134 |
| 6118 } } // namespace v8::internal | 6135 } } // namespace v8::internal |
| OLD | NEW |