Chromium Code Reviews| 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 4266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4277 return; | 4277 return; |
| 4278 | 4278 |
| 4279 } else { | 4279 } else { |
| 4280 call = new HCallNamed(name, argument_count); | 4280 call = new HCallNamed(name, argument_count); |
| 4281 } | 4281 } |
| 4282 | 4282 |
| 4283 } else { | 4283 } else { |
| 4284 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); | 4284 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); |
| 4285 bool global_call = (var != NULL) && var->is_global() && !var->is_this(); | 4285 bool global_call = (var != NULL) && var->is_global() && !var->is_this(); |
| 4286 | 4286 |
| 4287 if (!global_call) { | |
| 4288 ++argument_count; | |
|
Kevin Millikin (Chromium)
2010/12/21 10:38:50
Please don't make this change.
I'm currently refa
| |
| 4289 VisitArgument(expr->expression()); | |
| 4290 CHECK_BAILOUT; | |
| 4291 } | |
| 4292 | |
| 4293 if (global_call) { | 4287 if (global_call) { |
| 4294 // If there is a global property cell for the name at compile time and | 4288 // If there is a global property cell for the name at compile time and |
| 4295 // access check is not enabled we assume that the function will not change | 4289 // access check is not enabled we assume that the function will not change |
| 4296 // and generate optimized code for calling the function. | 4290 // and generate optimized code for calling the function. |
| 4297 CompilationInfo* info = graph()->info(); | 4291 CompilationInfo* info = graph()->info(); |
| 4298 bool known_global_function = info->has_global_object() && | 4292 bool known_global_function = info->has_global_object() && |
| 4299 !info->global_object()->IsAccessCheckNeeded() && | 4293 !info->global_object()->IsAccessCheckNeeded() && |
| 4300 expr->ComputeGlobalTarget(Handle<GlobalObject>(info->global_object()), | 4294 expr->ComputeGlobalTarget(Handle<GlobalObject>(info->global_object()), |
| 4301 var->name()); | 4295 var->name()); |
| 4302 if (known_global_function) { | 4296 if (known_global_function) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4337 CHECK_BAILOUT; | 4331 CHECK_BAILOUT; |
| 4338 | 4332 |
| 4339 call = new HCallKnownGlobal(expr->target(), argument_count); | 4333 call = new HCallKnownGlobal(expr->target(), argument_count); |
| 4340 } else { | 4334 } else { |
| 4341 PushAndAdd(new HGlobalObject); | 4335 PushAndAdd(new HGlobalObject); |
| 4342 VisitArgumentList(expr->arguments()); | 4336 VisitArgumentList(expr->arguments()); |
| 4343 CHECK_BAILOUT; | 4337 CHECK_BAILOUT; |
| 4344 | 4338 |
| 4345 call = new HCallGlobal(var->name(), argument_count); | 4339 call = new HCallGlobal(var->name(), argument_count); |
| 4346 } | 4340 } |
| 4341 } else { | |
| 4342 // Non-global call. | |
| 4343 ++argument_count; | |
| 4344 VisitArgument(expr->expression()); | |
| 4345 CHECK_BAILOUT; | |
| 4347 | 4346 |
| 4348 } else { | |
| 4349 PushAndAdd(new HGlobalReceiver); | 4347 PushAndAdd(new HGlobalReceiver); |
| 4350 VisitArgumentList(expr->arguments()); | 4348 VisitArgumentList(expr->arguments()); |
| 4351 CHECK_BAILOUT; | 4349 CHECK_BAILOUT; |
| 4352 | 4350 |
| 4353 call = new HCallFunction(argument_count); | 4351 call = new HCallFunction(argument_count); |
| 4354 } | 4352 } |
| 4355 } | 4353 } |
| 4356 | 4354 |
| 4357 call->set_position(expr->position()); | 4355 call->set_position(expr->position()); |
| 4358 ProcessCall(call); | 4356 ProcessCall(call); |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5138 // Fast swapping of elements. Takes three expressions, the object and two | 5136 // Fast swapping of elements. Takes three expressions, the object and two |
| 5139 // indices. This should only be used if the indices are known to be | 5137 // indices. This should only be used if the indices are known to be |
| 5140 // non-negative and within bounds of the elements array at the call site. | 5138 // non-negative and within bounds of the elements array at the call site. |
| 5141 void HGraphBuilder::GenerateSwapElements(int argument_count, int ast_id) { | 5139 void HGraphBuilder::GenerateSwapElements(int argument_count, int ast_id) { |
| 5142 BAILOUT("inlined runtime function: SwapElements"); | 5140 BAILOUT("inlined runtime function: SwapElements"); |
| 5143 } | 5141 } |
| 5144 | 5142 |
| 5145 | 5143 |
| 5146 // Fast call for custom callbacks. | 5144 // Fast call for custom callbacks. |
| 5147 void HGraphBuilder::GenerateCallFunction(int argument_count, int ast_id) { | 5145 void HGraphBuilder::GenerateCallFunction(int argument_count, int ast_id) { |
| 5148 BAILOUT("inlined runtime function: CallFunction"); | 5146 // BAILOUT("boo"); |
|
Lasse Reichstein
2010/12/21 10:19:21
I'll remove this :)
Søren Thygesen Gjesse
2010/12/21 10:25:03
Strange comment.
| |
| 5147 ASSERT(argument_count >= 2); | |
| 5148 // Move function from top of stack to below arguments. | |
| 5149 HValue* function = Pop(); | |
| 5150 int argc = argument_count - 1; // Don't count the function itself. | |
| 5151 SmartPointer<HValue*> arguments(NewArray<HValue*>(argc)); | |
| 5152 for (int i = 0; i < argc; i++) { arguments[i] = Pop(); } | |
|
Søren Thygesen Gjesse
2010/12/21 10:25:03
We normally split for statements across three line
| |
| 5153 Push(function); | |
| 5154 for (int i = argc - 1; i >= 0; i--) { Push(arguments[i]); } | |
|
Søren Thygesen Gjesse
2010/12/21 10:25:03
Ditto.
| |
| 5155 HCallFunction* result = new HCallFunction(argument_count); | |
| 5156 ProcessCall(result); | |
| 5157 ast_context()->ReturnInstruction(result, ast_id); | |
| 5149 } | 5158 } |
| 5150 | 5159 |
| 5151 | 5160 |
| 5152 // Fast call to math functions. | 5161 // Fast call to math functions. |
| 5153 void HGraphBuilder::GenerateMathPow(int argument_count, int ast_id) { | 5162 void HGraphBuilder::GenerateMathPow(int argument_count, int ast_id) { |
| 5154 ASSERT_EQ(2, argument_count); | 5163 ASSERT_EQ(2, argument_count); |
| 5155 HValue* right = Pop(); | 5164 HValue* right = Pop(); |
| 5156 HValue* left = Pop(); | 5165 HValue* left = Pop(); |
| 5157 HPower* result = new HPower(left, right); | 5166 HPower* result = new HPower(left, right); |
| 5158 ast_context()->ReturnInstruction(result, ast_id); | 5167 ast_context()->ReturnInstruction(result, ast_id); |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5677 } | 5686 } |
| 5678 | 5687 |
| 5679 #ifdef DEBUG | 5688 #ifdef DEBUG |
| 5680 if (graph_ != NULL) graph_->Verify(); | 5689 if (graph_ != NULL) graph_->Verify(); |
| 5681 if (chunk_ != NULL) chunk_->Verify(); | 5690 if (chunk_ != NULL) chunk_->Verify(); |
| 5682 if (allocator_ != NULL) allocator_->Verify(); | 5691 if (allocator_ != NULL) allocator_->Verify(); |
| 5683 #endif | 5692 #endif |
| 5684 } | 5693 } |
| 5685 | 5694 |
| 5686 } } // namespace v8::internal | 5695 } } // namespace v8::internal |
| OLD | NEW |