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

Side by Side Diff: src/hydrogen.cc

Issue 6686003: Refactor fast API call. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Next round Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4223 matching lines...) Expand 10 before | Expand all | Expand 10 after
4234 expr->GetReceiverTypes()->first(), 4234 expr->GetReceiverTypes()->first(),
4235 true); 4235 true);
4236 HInstruction* result = 4236 HInstruction* result =
4237 new HApplyArguments(function, receiver, length, elements); 4237 new HApplyArguments(function, receiver, length, elements);
4238 result->set_position(expr->position()); 4238 result->set_position(expr->position());
4239 ast_context()->ReturnInstruction(result, expr->id()); 4239 ast_context()->ReturnInstruction(result, expr->id());
4240 return true; 4240 return true;
4241 } 4241 }
4242 4242
4243 4243
4244 static bool HasCustomCallGenerator(Handle<JSFunction> function) {
4245 SharedFunctionInfo* info = function->shared();
4246 return info->HasBuiltinFunctionId() &&
4247 CallStubCompiler::HasCustomCallGenerator(info->builtin_function_id());
4248 }
4249
4250
4251 void HGraphBuilder::VisitCall(Call* expr) { 4244 void HGraphBuilder::VisitCall(Call* expr) {
4252 Expression* callee = expr->expression(); 4245 Expression* callee = expr->expression();
4253 int argument_count = expr->arguments()->length() + 1; // Plus receiver. 4246 int argument_count = expr->arguments()->length() + 1; // Plus receiver.
4254 HInstruction* call = NULL; 4247 HInstruction* call = NULL;
4255 4248
4256 Property* prop = callee->AsProperty(); 4249 Property* prop = callee->AsProperty();
4257 if (prop != NULL) { 4250 if (prop != NULL) {
4258 if (!prop->key()->IsPropertyName()) { 4251 if (!prop->key()->IsPropertyName()) {
4259 // Keyed function call. 4252 // Keyed function call.
4260 VISIT_FOR_VALUE(prop->obj()); 4253 VISIT_FOR_VALUE(prop->obj());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4298 if (expr->IsMonomorphic()) { 4291 if (expr->IsMonomorphic()) {
4299 Handle<Map> receiver_map = 4292 Handle<Map> receiver_map =
4300 (types == NULL) ? Handle<Map>::null() : types->first(); 4293 (types == NULL) ? Handle<Map>::null() : types->first();
4301 if (TryInlineBuiltinFunction(expr, 4294 if (TryInlineBuiltinFunction(expr,
4302 receiver, 4295 receiver,
4303 receiver_map, 4296 receiver_map,
4304 expr->check_type())) { 4297 expr->check_type())) {
4305 return; 4298 return;
4306 } 4299 }
4307 4300
4308 if (HasCustomCallGenerator(expr->target()) || 4301 if (CallStubCompiler::HasCustomCallGenerator(*expr->target()) ||
4309 CallOptimization(*expr->target()).is_simple_api_call() ||
4310 expr->check_type() != RECEIVER_MAP_CHECK) { 4302 expr->check_type() != RECEIVER_MAP_CHECK) {
4311 // When the target has a custom call IC generator, use the IC, 4303 // When the target has a custom call IC generator, use the IC,
4312 // because it is likely to generate better code. Similarly, we 4304 // because it is likely to generate better code. Also use the IC
4313 // generate better call stubs for some API functions. 4305 // when a primitive receiver check is required.
4314 // Also use the IC when a primitive receiver check is required.
4315 HContext* context = new HContext; 4306 HContext* context = new HContext;
4316 AddInstruction(context); 4307 AddInstruction(context);
4317 call = PreProcessCall(new HCallNamed(context, name, argument_count)); 4308 call = PreProcessCall(new HCallNamed(context, name, argument_count));
4318 } else { 4309 } else {
4319 AddCheckConstantFunction(expr, receiver, receiver_map, true); 4310 AddCheckConstantFunction(expr, receiver, receiver_map, true);
4320 4311
4321 if (TryInline(expr)) { 4312 if (TryInline(expr)) {
4322 return; 4313 return;
4323 } else { 4314 } else {
4324 // Check for bailout, as the TryInline call in the if condition above 4315 // Check for bailout, as the TryInline call in the if condition above
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
5956 } 5947 }
5957 } 5948 }
5958 5949
5959 #ifdef DEBUG 5950 #ifdef DEBUG
5960 if (graph_ != NULL) graph_->Verify(); 5951 if (graph_ != NULL) graph_->Verify();
5961 if (allocator_ != NULL) allocator_->Verify(); 5952 if (allocator_ != NULL) allocator_->Verify();
5962 #endif 5953 #endif
5963 } 5954 }
5964 5955
5965 } } // namespace v8::internal 5956 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698