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

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

Issue 647015: Remove the LookupResult IsValid method because it is confusing.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.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 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 void FastCodeGenSyntaxChecker::VisitVariableProxy(VariableProxy* expr) { 214 void FastCodeGenSyntaxChecker::VisitVariableProxy(VariableProxy* expr) {
215 // Only global variable references are supported. 215 // Only global variable references are supported.
216 Variable* var = expr->var(); 216 Variable* var = expr->var();
217 if (!var->is_global() || var->is_this()) BAILOUT("Non-global variable"); 217 if (!var->is_global() || var->is_this()) BAILOUT("Non-global variable");
218 218
219 // Check if the global variable is existing and non-deletable. 219 // Check if the global variable is existing and non-deletable.
220 if (info()->has_global_object()) { 220 if (info()->has_global_object()) {
221 LookupResult lookup; 221 LookupResult lookup;
222 info()->global_object()->Lookup(*expr->name(), &lookup); 222 info()->global_object()->Lookup(*expr->name(), &lookup);
223 if (!lookup.IsValid()) { 223 if (!lookup.IsProperty()) {
224 BAILOUT("Non-existing global variable"); 224 BAILOUT("Non-existing global variable");
225 } 225 }
226 // We do not handle global variables with accessors or interceptors. 226 // We do not handle global variables with accessors or interceptors.
227 if (lookup.type() != NORMAL) { 227 if (lookup.type() != NORMAL) {
228 BAILOUT("Global variable with accessors or interceptors."); 228 BAILOUT("Global variable with accessors or interceptors.");
229 } 229 }
230 // We do not handle deletable global variables. 230 // We do not handle deletable global variables.
231 if (!lookup.IsDontDelete()) { 231 if (!lookup.IsDontDelete()) {
232 BAILOUT("Deletable global variable"); 232 BAILOUT("Deletable global variable");
233 } 233 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 // We will only specialize for fields on the object itself. 278 // We will only specialize for fields on the object itself.
279 // Expression::IsPropertyName implies that the name is a literal 279 // Expression::IsPropertyName implies that the name is a literal
280 // symbol but we do not assume that. 280 // symbol but we do not assume that.
281 Literal* key = prop->key()->AsLiteral(); 281 Literal* key = prop->key()->AsLiteral();
282 if (key != NULL && key->handle()->IsString()) { 282 if (key != NULL && key->handle()->IsString()) {
283 Handle<Object> receiver = info()->receiver(); 283 Handle<Object> receiver = info()->receiver();
284 Handle<String> name = Handle<String>::cast(key->handle()); 284 Handle<String> name = Handle<String>::cast(key->handle());
285 LookupResult lookup; 285 LookupResult lookup;
286 receiver->Lookup(*name, &lookup); 286 receiver->Lookup(*name, &lookup);
287 if (!lookup.IsValid()) { 287 if (!lookup.IsProperty()) {
288 BAILOUT("Assigned property not found at compile time"); 288 BAILOUT("Assigned property not found at compile time");
289 } 289 }
290 if (lookup.holder() != *receiver) BAILOUT("Non-own property assignment"); 290 if (lookup.holder() != *receiver) BAILOUT("Non-own property assignment");
291 if (!lookup.type() == FIELD) BAILOUT("Non-field property assignment"); 291 if (!lookup.type() == FIELD) BAILOUT("Non-field property assignment");
292 } else { 292 } else {
293 UNREACHABLE(); 293 UNREACHABLE();
294 BAILOUT("Unexpected non-string-literal property key"); 294 BAILOUT("Unexpected non-string-literal property key");
295 } 295 }
296 296
297 Visit(expr->value()); 297 Visit(expr->value());
(...skipping 17 matching lines...) Expand all
315 315
316 // We will only specialize for fields on the object itself. 316 // We will only specialize for fields on the object itself.
317 // Expression::IsPropertyName implies that the name is a literal 317 // Expression::IsPropertyName implies that the name is a literal
318 // symbol but we do not assume that. 318 // symbol but we do not assume that.
319 Literal* key = expr->key()->AsLiteral(); 319 Literal* key = expr->key()->AsLiteral();
320 if (key != NULL && key->handle()->IsString()) { 320 if (key != NULL && key->handle()->IsString()) {
321 Handle<Object> receiver = info()->receiver(); 321 Handle<Object> receiver = info()->receiver();
322 Handle<String> name = Handle<String>::cast(key->handle()); 322 Handle<String> name = Handle<String>::cast(key->handle());
323 LookupResult lookup; 323 LookupResult lookup;
324 receiver->Lookup(*name, &lookup); 324 receiver->Lookup(*name, &lookup);
325 if (!lookup.IsValid()) { 325 if (!lookup.IsProperty()) {
326 BAILOUT("Referenced property not found at compile time"); 326 BAILOUT("Referenced property not found at compile time");
327 } 327 }
328 if (lookup.holder() != *receiver) BAILOUT("Non-own property reference"); 328 if (lookup.holder() != *receiver) BAILOUT("Non-own property reference");
329 if (!lookup.type() == FIELD) BAILOUT("Non-field property reference"); 329 if (!lookup.type() == FIELD) BAILOUT("Non-field property reference");
330 } else { 330 } else {
331 UNREACHABLE(); 331 UNREACHABLE();
332 BAILOUT("Unexpected non-string-literal property key"); 332 BAILOUT("Unexpected non-string-literal property key");
333 } 333 }
334 } 334 }
335 335
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 580
581 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) { 581 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
582 ASSERT(expr->var()->is_global() && !expr->var()->is_this()); 582 ASSERT(expr->var()->is_global() && !expr->var()->is_this());
583 // Check if we can compile a global variable load directly from the cell. 583 // Check if we can compile a global variable load directly from the cell.
584 ASSERT(info()->has_global_object()); 584 ASSERT(info()->has_global_object());
585 LookupResult lookup; 585 LookupResult lookup;
586 info()->global_object()->Lookup(*expr->name(), &lookup); 586 info()->global_object()->Lookup(*expr->name(), &lookup);
587 // We only support normal (non-accessor/interceptor) DontDelete properties 587 // We only support normal (non-accessor/interceptor) DontDelete properties
588 // for now. 588 // for now.
589 ASSERT(lookup.IsValid()); 589 ASSERT(lookup.IsProperty());
590 ASSERT_EQ(NORMAL, lookup.type()); 590 ASSERT_EQ(NORMAL, lookup.type());
591 ASSERT(lookup.IsDontDelete()); 591 ASSERT(lookup.IsDontDelete());
592 Handle<Object> cell(info()->global_object()->GetPropertyCell(&lookup)); 592 Handle<Object> cell(info()->global_object()->GetPropertyCell(&lookup));
593 593
594 // Global variable lookups do not have side effects, so we do not need to 594 // Global variable lookups do not have side effects, so we do not need to
595 // emit code if we are in an effect context. 595 // emit code if we are in an effect context.
596 if (!destination().is(no_reg)) { 596 if (!destination().is(no_reg)) {
597 Comment cmnt(masm(), ";; Global"); 597 Comment cmnt(masm(), ";; Global");
598 if (FLAG_print_ir) { 598 if (FLAG_print_ir) {
599 SmartPointer<char> name = expr->name()->ToCString(); 599 SmartPointer<char> name = expr->name()->ToCString();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 741
742 742
743 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { 743 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
744 UNREACHABLE(); 744 UNREACHABLE();
745 } 745 }
746 746
747 #undef __ 747 #undef __
748 748
749 749
750 } } // namespace v8::internal 750 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698