OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 3892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3903 frame_->SpillAll(); | 3903 frame_->SpillAll(); |
3904 frame_->CallRuntime(Runtime::kDebugBreak, 0); | 3904 frame_->CallRuntime(Runtime::kDebugBreak, 0); |
3905 // Ignore the return value. | 3905 // Ignore the return value. |
3906 #endif | 3906 #endif |
3907 } | 3907 } |
3908 | 3908 |
3909 | 3909 |
3910 void CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) { | 3910 void CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) { |
3911 ASSERT(boilerplate->IsBoilerplate()); | 3911 ASSERT(boilerplate->IsBoilerplate()); |
3912 | 3912 |
| 3913 // The inevitable call will sync frame elements to memory anyway, so |
| 3914 // we do it eagerly to allow us to push the arguments directly into |
| 3915 // place. |
| 3916 frame_->SyncRange(0, frame_->element_count() - 1); |
| 3917 |
3913 // Use the fast case closure allocation code that allocates in new | 3918 // Use the fast case closure allocation code that allocates in new |
3914 // space for nested functions that don't need literals cloning. | 3919 // space for nested functions that don't need literals cloning. |
3915 if (scope()->is_function_scope() && boilerplate->NumberOfLiterals() == 0) { | 3920 if (scope()->is_function_scope() && boilerplate->NumberOfLiterals() == 0) { |
3916 FastNewClosureStub stub; | 3921 FastNewClosureStub stub; |
3917 frame_->Push(boilerplate); | 3922 frame_->EmitPush(Immediate(boilerplate)); |
3918 Result answer = frame_->CallStub(&stub, 1); | 3923 Result answer = frame_->CallStub(&stub, 1); |
3919 frame_->Push(&answer); | 3924 frame_->Push(&answer); |
3920 } else { | 3925 } else { |
3921 // Call the runtime to instantiate the function boilerplate | 3926 // Call the runtime to instantiate the function boilerplate |
3922 // object. The inevitable call will sync frame elements to memory | 3927 // object. |
3923 // anyway, so we do it eagerly to allow us to push the arguments | |
3924 // directly into place. | |
3925 frame_->SyncRange(0, frame_->element_count() - 1); | |
3926 | |
3927 // Create a new closure. | |
3928 frame_->EmitPush(esi); | 3928 frame_->EmitPush(esi); |
3929 frame_->EmitPush(Immediate(boilerplate)); | 3929 frame_->EmitPush(Immediate(boilerplate)); |
3930 Result result = frame_->CallRuntime(Runtime::kNewClosure, 2); | 3930 Result result = frame_->CallRuntime(Runtime::kNewClosure, 2); |
3931 frame_->Push(&result); | 3931 frame_->Push(&result); |
3932 } | 3932 } |
3933 } | 3933 } |
3934 | 3934 |
3935 | 3935 |
3936 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { | 3936 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { |
3937 Comment cmnt(masm_, "[ FunctionLiteral"); | 3937 Comment cmnt(masm_, "[ FunctionLiteral"); |
(...skipping 5832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9770 | 9770 |
9771 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 9771 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
9772 // tagged as a small integer. | 9772 // tagged as a small integer. |
9773 __ bind(&runtime); | 9773 __ bind(&runtime); |
9774 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); | 9774 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); |
9775 } | 9775 } |
9776 | 9776 |
9777 #undef __ | 9777 #undef __ |
9778 | 9778 |
9779 } } // namespace v8::internal | 9779 } } // namespace v8::internal |
OLD | NEW |