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

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

Issue 551189: Propagate receiver from initial call site to code generator. (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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } while (false) 43 } while (false)
44 44
45 45
46 #define CHECK_BAILOUT \ 46 #define CHECK_BAILOUT \
47 do { \ 47 do { \
48 if (!has_supported_syntax_) return; \ 48 if (!has_supported_syntax_) return; \
49 } while (false) 49 } while (false)
50 50
51 51
52 void FastCodeGenSyntaxChecker::Check(FunctionLiteral* fun) { 52 void FastCodeGenSyntaxChecker::Check(FunctionLiteral* fun) {
53 Scope* scope = fun->scope(); 53 // We do not specialize if we do not have a receiver.
54 if (receiver().is_null()) BAILOUT("No receiver");
54 55
55 // We do not support stack or heap slots (both of which require 56 // We do not support stack or heap slots (both of which require
56 // allocation). 57 // allocation).
58 Scope* scope = fun->scope();
57 if (scope->num_stack_slots() > 0) { 59 if (scope->num_stack_slots() > 0) {
58 BAILOUT("Function has stack-allocated locals"); 60 BAILOUT("Function has stack-allocated locals");
59 } 61 }
60 if (scope->num_heap_slots() > 0) { 62 if (scope->num_heap_slots() > 0) {
61 BAILOUT("Function has context-allocated locals"); 63 BAILOUT("Function has context-allocated locals");
62 } 64 }
63 65
64 VisitDeclarations(scope->declarations()); 66 VisitDeclarations(scope->declarations());
65 CHECK_BAILOUT; 67 CHECK_BAILOUT;
66 68
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 Property* prop = expr->target()->AsProperty(); 241 Property* prop = expr->target()->AsProperty();
240 if (prop == NULL) BAILOUT("Non-property assignment"); 242 if (prop == NULL) BAILOUT("Non-property assignment");
241 VariableProxy* proxy = prop->obj()->AsVariableProxy(); 243 VariableProxy* proxy = prop->obj()->AsVariableProxy();
242 if (proxy == NULL || !proxy->var()->is_this()) { 244 if (proxy == NULL || !proxy->var()->is_this()) {
243 BAILOUT("Non-this-property assignment"); 245 BAILOUT("Non-this-property assignment");
244 } 246 }
245 if (!prop->key()->IsPropertyName()) { 247 if (!prop->key()->IsPropertyName()) {
246 BAILOUT("Non-named-property assignment"); 248 BAILOUT("Non-named-property assignment");
247 } 249 }
248 250
251 // We will only specialize for fields on the object itself.
252 // Expression::IsPropertyName implies that the name is a literal
253 // symbol but we do not assume that.
254 Literal* key = prop->key()->AsLiteral();
255 if (key != NULL && key->handle()->IsString()) {
256 Handle<String> name = Handle<String>::cast(key->handle());
257 LookupResult lookup;
258 receiver()->Lookup(*name, &lookup);
259 if (lookup.holder() != *receiver()) BAILOUT("Non-own property assignment");
260 if (!lookup.type() == FIELD) BAILOUT("Non-field property assignment");
261 } else {
262 UNREACHABLE();
263 BAILOUT("Unexpected non-string-literal property key");
264 }
265
249 Visit(expr->value()); 266 Visit(expr->value());
250 } 267 }
251 268
252 269
253 void FastCodeGenSyntaxChecker::VisitThrow(Throw* expr) { 270 void FastCodeGenSyntaxChecker::VisitThrow(Throw* expr) {
254 BAILOUT("Throw"); 271 BAILOUT("Throw");
255 } 272 }
256 273
257 274
258 void FastCodeGenSyntaxChecker::VisitProperty(Property* expr) { 275 void FastCodeGenSyntaxChecker::VisitProperty(Property* expr) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 314
298 void FastCodeGenSyntaxChecker::VisitThisFunction(ThisFunction* expr) { 315 void FastCodeGenSyntaxChecker::VisitThisFunction(ThisFunction* expr) {
299 BAILOUT("ThisFunction"); 316 BAILOUT("ThisFunction");
300 } 317 }
301 318
302 #undef BAILOUT 319 #undef BAILOUT
303 #undef CHECK_BAILOUT 320 #undef CHECK_BAILOUT
304 321
305 322
306 } } // namespace v8::internal 323 } } // namespace v8::internal
OLDNEW
« src/compiler.h ('K') | « src/fast-codegen.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698