Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 600097: Change the interface of CodeGenerator::InstantiateBoilerplate. (Closed)
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3894 matching lines...) Expand 10 before | Expand all | Expand 10 after
3905 #ifdef ENABLE_DEBUGGER_SUPPORT 3905 #ifdef ENABLE_DEBUGGER_SUPPORT
3906 // Spill everything, even constants, to the frame. 3906 // Spill everything, even constants, to the frame.
3907 frame_->SpillAll(); 3907 frame_->SpillAll();
3908 3908
3909 frame_->DebugBreak(); 3909 frame_->DebugBreak();
3910 // Ignore the return value. 3910 // Ignore the return value.
3911 #endif 3911 #endif
3912 } 3912 }
3913 3913
3914 3914
3915 void CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) { 3915 Result CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) {
3916 ASSERT(boilerplate->IsBoilerplate()); 3916 ASSERT(boilerplate->IsBoilerplate());
3917 3917
3918 // The inevitable call will sync frame elements to memory anyway, so 3918 // The inevitable call will sync frame elements to memory anyway, so
3919 // we do it eagerly to allow us to push the arguments directly into 3919 // we do it eagerly to allow us to push the arguments directly into
3920 // place. 3920 // place.
3921 frame_->SyncRange(0, frame_->element_count() - 1); 3921 frame()->SyncRange(0, frame()->element_count() - 1);
3922 3922
3923 // Use the fast case closure allocation code that allocates in new 3923 // Use the fast case closure allocation code that allocates in new
3924 // space for nested functions that don't need literals cloning. 3924 // space for nested functions that don't need literals cloning.
3925 if (scope()->is_function_scope() && boilerplate->NumberOfLiterals() == 0) { 3925 if (scope()->is_function_scope() && boilerplate->NumberOfLiterals() == 0) {
3926 FastNewClosureStub stub; 3926 FastNewClosureStub stub;
3927 frame_->EmitPush(Immediate(boilerplate)); 3927 frame()->EmitPush(Immediate(boilerplate));
3928 Result answer = frame_->CallStub(&stub, 1); 3928 return frame()->CallStub(&stub, 1);
3929 frame_->Push(&answer);
3930 } else { 3929 } else {
3931 // Call the runtime to instantiate the function boilerplate 3930 // Call the runtime to instantiate the function boilerplate
3932 // object. 3931 // object.
3933 frame_->EmitPush(esi); 3932 frame()->EmitPush(esi);
3934 frame_->EmitPush(Immediate(boilerplate)); 3933 frame()->EmitPush(Immediate(boilerplate));
3935 Result result = frame_->CallRuntime(Runtime::kNewClosure, 2); 3934 return frame()->CallRuntime(Runtime::kNewClosure, 2);
3936 frame_->Push(&result);
3937 } 3935 }
3938 } 3936 }
3939 3937
3940 3938
3941 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { 3939 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) {
3942 Comment cmnt(masm_, "[ FunctionLiteral"); 3940 Comment cmnt(masm_, "[ FunctionLiteral");
3943 3941
3944 // Build the function boilerplate and instantiate it. 3942 // Build the function boilerplate and instantiate it.
3945 Handle<JSFunction> boilerplate = 3943 Handle<JSFunction> boilerplate =
3946 Compiler::BuildBoilerplate(node, script(), this); 3944 Compiler::BuildBoilerplate(node, script(), this);
3947 // Check for stack-overflow exception. 3945 // Check for stack-overflow exception.
3948 if (HasStackOverflow()) return; 3946 if (HasStackOverflow()) return;
3949 InstantiateBoilerplate(boilerplate); 3947 Result result = InstantiateBoilerplate(boilerplate);
3948 frame()->Push(&result);
3950 } 3949 }
3951 3950
3952 3951
3953 void CodeGenerator::VisitFunctionBoilerplateLiteral( 3952 void CodeGenerator::VisitFunctionBoilerplateLiteral(
3954 FunctionBoilerplateLiteral* node) { 3953 FunctionBoilerplateLiteral* node) {
3955 Comment cmnt(masm_, "[ FunctionBoilerplateLiteral"); 3954 Comment cmnt(masm_, "[ FunctionBoilerplateLiteral");
3956 InstantiateBoilerplate(node->boilerplate()); 3955 Result result = InstantiateBoilerplate(node->boilerplate());
3956 frame()->Push(&result);
3957 } 3957 }
3958 3958
3959 3959
3960 void CodeGenerator::VisitConditional(Conditional* node) { 3960 void CodeGenerator::VisitConditional(Conditional* node) {
3961 Comment cmnt(masm_, "[ Conditional"); 3961 Comment cmnt(masm_, "[ Conditional");
3962 JumpTarget then; 3962 JumpTarget then;
3963 JumpTarget else_; 3963 JumpTarget else_;
3964 JumpTarget exit; 3964 JumpTarget exit;
3965 ControlDestination dest(&then, &else_, true); 3965 ControlDestination dest(&then, &else_, true);
3966 LoadCondition(node->condition(), &dest, true); 3966 LoadCondition(node->condition(), &dest, true);
(...skipping 6142 matching lines...) Expand 10 before | Expand all | Expand 10 after
10109 10109
10110 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 10110 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
10111 // tagged as a small integer. 10111 // tagged as a small integer.
10112 __ bind(&runtime); 10112 __ bind(&runtime);
10113 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); 10113 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1);
10114 } 10114 }
10115 10115
10116 #undef __ 10116 #undef __
10117 10117
10118 } } // namespace v8::internal 10118 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698