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

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

Issue 552232: Introduce a stack-allocated structure to encapsulate compile-time information. (Closed)
Patch Set: Remove inadvertently included files. 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/fast-codegen.h ('k') | src/handles.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 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return; \ 42 return; \
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 CompilationInfo* info) {
53 // We do not specialize if we do not have a receiver. 54 // We do not specialize if we do not have a receiver.
54 if (receiver().is_null()) BAILOUT("No receiver"); 55 if (!info->has_receiver()) BAILOUT("No receiver");
55 56
56 // We do not support stack or heap slots (both of which require 57 // We do not support stack or heap slots (both of which require
57 // allocation). 58 // allocation).
58 Scope* scope = fun->scope(); 59 Scope* scope = fun->scope();
59 if (scope->num_stack_slots() > 0) { 60 if (scope->num_stack_slots() > 0) {
60 BAILOUT("Function has stack-allocated locals"); 61 BAILOUT("Function has stack-allocated locals");
61 } 62 }
62 if (scope->num_heap_slots() > 0) { 63 if (scope->num_heap_slots() > 0) {
63 BAILOUT("Function has context-allocated locals"); 64 BAILOUT("Function has context-allocated locals");
64 } 65 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 247 }
247 if (!prop->key()->IsPropertyName()) { 248 if (!prop->key()->IsPropertyName()) {
248 BAILOUT("Non-named-property assignment"); 249 BAILOUT("Non-named-property assignment");
249 } 250 }
250 251
251 // We will only specialize for fields on the object itself. 252 // We will only specialize for fields on the object itself.
252 // Expression::IsPropertyName implies that the name is a literal 253 // Expression::IsPropertyName implies that the name is a literal
253 // symbol but we do not assume that. 254 // symbol but we do not assume that.
254 Literal* key = prop->key()->AsLiteral(); 255 Literal* key = prop->key()->AsLiteral();
255 if (key != NULL && key->handle()->IsString()) { 256 if (key != NULL && key->handle()->IsString()) {
257 Handle<Object> receiver = info()->receiver();
256 Handle<String> name = Handle<String>::cast(key->handle()); 258 Handle<String> name = Handle<String>::cast(key->handle());
257 LookupResult lookup; 259 LookupResult lookup;
258 receiver()->Lookup(*name, &lookup); 260 receiver->Lookup(*name, &lookup);
259 if (lookup.holder() != *receiver()) BAILOUT("Non-own property assignment"); 261 if (lookup.holder() != *receiver) BAILOUT("Non-own property assignment");
260 if (!lookup.type() == FIELD) BAILOUT("Non-field property assignment"); 262 if (!lookup.type() == FIELD) BAILOUT("Non-field property assignment");
261 } else { 263 } else {
262 UNREACHABLE(); 264 UNREACHABLE();
263 BAILOUT("Unexpected non-string-literal property key"); 265 BAILOUT("Unexpected non-string-literal property key");
264 } 266 }
265 267
266 Visit(expr->value()); 268 Visit(expr->value());
267 } 269 }
268 270
269 271
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 316
315 void FastCodeGenSyntaxChecker::VisitThisFunction(ThisFunction* expr) { 317 void FastCodeGenSyntaxChecker::VisitThisFunction(ThisFunction* expr) {
316 BAILOUT("ThisFunction"); 318 BAILOUT("ThisFunction");
317 } 319 }
318 320
319 #undef BAILOUT 321 #undef BAILOUT
320 #undef CHECK_BAILOUT 322 #undef CHECK_BAILOUT
321 323
322 324
323 } } // namespace v8::internal 325 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/fast-codegen.h ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698