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

Side by Side Diff: src/hydrogen.cc

Issue 10828066: Inline simple getter calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Deactivate accessor inlining by default. Created 8 years, 4 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 6334 matching lines...) Expand 10 before | Expand all | Expand 10 after
6345 6345
6346 } else if (expr->key()->IsPropertyName()) { 6346 } else if (expr->key()->IsPropertyName()) {
6347 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); 6347 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName();
6348 SmallMapList* types = expr->GetReceiverTypes(); 6348 SmallMapList* types = expr->GetReceiverTypes();
6349 6349
6350 if (expr->IsMonomorphic()) { 6350 if (expr->IsMonomorphic()) {
6351 Handle<Map> map = types->first(); 6351 Handle<Map> map = types->first();
6352 Handle<AccessorPair> accessors; 6352 Handle<AccessorPair> accessors;
6353 Handle<JSObject> holder; 6353 Handle<JSObject> holder;
6354 if (LookupAccessorPair(map, name, &accessors, &holder)) { 6354 if (LookupAccessorPair(map, name, &accessors, &holder)) {
6355 instr = BuildCallGetter(Pop(), map, accessors, holder); 6355 AddCheckConstantFunction(holder, Top(), map, true);
6356 Handle<JSFunction> getter(JSFunction::cast(accessors->getter()));
6357 if (FLAG_inline_accessors &&
6358 TryInlineGetter(getter, expr->id(), expr->ReturnId())) return;
6359 AddInstruction(new(zone()) HPushArgument(Pop()));
6360 instr = new(zone()) HCallConstantFunction(getter, 1);
6356 } else { 6361 } else {
6357 instr = BuildLoadNamedMonomorphic(Pop(), name, expr, map); 6362 instr = BuildLoadNamedMonomorphic(Pop(), name, expr, map);
6358 } 6363 }
6359 } else if (types != NULL && types->length() > 1) { 6364 } else if (types != NULL && types->length() > 1) {
6360 return HandlePolymorphicLoadNamedField(expr, Pop(), types, name); 6365 return HandlePolymorphicLoadNamedField(expr, Pop(), types, name);
6361 } else { 6366 } else {
6362 instr = BuildLoadNamedGeneric(Pop(), name, expr); 6367 instr = BuildLoadNamedGeneric(Pop(), name, expr);
6363 } 6368 }
6364 6369
6365 } else { 6370 } else {
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
6913 return TryInline(CALL_AS_FUNCTION, 6918 return TryInline(CALL_AS_FUNCTION,
6914 expr->target(), 6919 expr->target(),
6915 expr->arguments()->length(), 6920 expr->arguments()->length(),
6916 receiver, 6921 receiver,
6917 expr->id(), 6922 expr->id(),
6918 expr->ReturnId(), 6923 expr->ReturnId(),
6919 CONSTRUCT_CALL_RETURN); 6924 CONSTRUCT_CALL_RETURN);
6920 } 6925 }
6921 6926
6922 6927
6928 bool HGraphBuilder::TryInlineGetter(Handle<JSFunction> getter,
Michael Starzinger 2012/07/30 09:38:43 It might be better to pass the "Property* expr" as
Sven Panne 2012/07/30 10:41:55 Done.
6929 int ast_id,
6930 int return_id) {
6931 return TryInline(CALL_AS_METHOD,
6932 getter,
6933 0,
6934 NULL,
6935 ast_id,
6936 return_id,
6937 NORMAL_RETURN);
6938 }
6939
6940
6923 bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) { 6941 bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) {
6924 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; 6942 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false;
6925 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); 6943 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id();
6926 switch (id) { 6944 switch (id) {
6927 case kMathRound: 6945 case kMathRound:
6928 case kMathAbs: 6946 case kMathAbs:
6929 case kMathSqrt: 6947 case kMathSqrt:
6930 case kMathLog: 6948 case kMathLog:
6931 case kMathSin: 6949 case kMathSin:
6932 case kMathCos: 6950 case kMathCos:
(...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after
9643 } 9661 }
9644 } 9662 }
9645 9663
9646 #ifdef DEBUG 9664 #ifdef DEBUG
9647 if (graph_ != NULL) graph_->Verify(false); // No full verify. 9665 if (graph_ != NULL) graph_->Verify(false); // No full verify.
9648 if (allocator_ != NULL) allocator_->Verify(); 9666 if (allocator_ != NULL) allocator_->Verify();
9649 #endif 9667 #endif
9650 } 9668 }
9651 9669
9652 } } // namespace v8::internal 9670 } } // namespace v8::internal
OLDNEW
« src/flag-definitions.h ('K') | « src/hydrogen.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698