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

Side by Side Diff: src/ast.cc

Issue 217823003: Make invalid LHSs that are calls late errors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 6 years, 8 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/ast.h ('k') | src/heap.h » ('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 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #define DECL_ACCEPT(type) \ 49 #define DECL_ACCEPT(type) \
50 void type::Accept(AstVisitor* v) { v->Visit##type(this); } 50 void type::Accept(AstVisitor* v) { v->Visit##type(this); }
51 AST_NODE_LIST(DECL_ACCEPT) 51 AST_NODE_LIST(DECL_ACCEPT)
52 #undef DECL_ACCEPT 52 #undef DECL_ACCEPT
53 53
54 54
55 // ---------------------------------------------------------------------------- 55 // ----------------------------------------------------------------------------
56 // Implementation of other node functionality. 56 // Implementation of other node functionality.
57 57
58 58
59 bool Expression::IsSmiLiteral() { 59 bool Expression::IsSmiLiteral() const {
60 return AsLiteral() != NULL && AsLiteral()->value()->IsSmi(); 60 return AsLiteral() != NULL && AsLiteral()->value()->IsSmi();
61 } 61 }
62 62
63 63
64 bool Expression::IsStringLiteral() { 64 bool Expression::IsStringLiteral() const {
65 return AsLiteral() != NULL && AsLiteral()->value()->IsString(); 65 return AsLiteral() != NULL && AsLiteral()->value()->IsString();
66 } 66 }
67 67
68 68
69 bool Expression::IsNullLiteral() { 69 bool Expression::IsNullLiteral() const {
70 return AsLiteral() != NULL && AsLiteral()->value()->IsNull(); 70 return AsLiteral() != NULL && AsLiteral()->value()->IsNull();
71 } 71 }
72 72
73 73
74 bool Expression::IsUndefinedLiteral(Isolate* isolate) { 74 bool Expression::IsUndefinedLiteral(Isolate* isolate) const {
75 VariableProxy* var_proxy = AsVariableProxy(); 75 const VariableProxy* var_proxy = AsVariableProxy();
76 if (var_proxy == NULL) return false; 76 if (var_proxy == NULL) return false;
77 Variable* var = var_proxy->var(); 77 Variable* var = var_proxy->var();
78 // The global identifier "undefined" is immutable. Everything 78 // The global identifier "undefined" is immutable. Everything
79 // else could be reassigned. 79 // else could be reassigned.
80 return var != NULL && var->location() == Variable::UNALLOCATED && 80 return var != NULL && var->location() == Variable::UNALLOCATED &&
81 var_proxy->name()->Equals(isolate->heap()->undefined_string()); 81 var_proxy->name()->Equals(isolate->heap()->undefined_string());
82 } 82 }
83 83
84 84
85 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position) 85 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 void BinaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { 456 void BinaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
457 // TODO(olivf) If this Operation is used in a test context, then the right 457 // TODO(olivf) If this Operation is used in a test context, then the right
458 // hand side has a ToBoolean stub and we want to collect the type information. 458 // hand side has a ToBoolean stub and we want to collect the type information.
459 // However the GraphBuilder expects it to be on the instruction corresponding 459 // However the GraphBuilder expects it to be on the instruction corresponding
460 // to the TestContext, therefore we have to store it here and not on the 460 // to the TestContext, therefore we have to store it here and not on the
461 // right hand operand. 461 // right hand operand.
462 set_to_boolean_types(oracle->ToBooleanTypes(right()->test_id())); 462 set_to_boolean_types(oracle->ToBooleanTypes(right()->test_id()));
463 } 463 }
464 464
465 465
466 bool BinaryOperation::ResultOverwriteAllowed() { 466 bool BinaryOperation::ResultOverwriteAllowed() const {
467 switch (op_) { 467 switch (op_) {
468 case Token::COMMA: 468 case Token::COMMA:
469 case Token::OR: 469 case Token::OR:
470 case Token::AND: 470 case Token::AND:
471 return false; 471 return false;
472 case Token::BIT_OR: 472 case Token::BIT_OR:
473 case Token::BIT_XOR: 473 case Token::BIT_XOR:
474 case Token::BIT_AND: 474 case Token::BIT_AND:
475 case Token::SHL: 475 case Token::SHL:
476 case Token::SAR: 476 case Token::SAR:
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); 1175 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1176 str = arr; 1176 str = arr;
1177 } else { 1177 } else {
1178 str = DoubleToCString(value_->Number(), buffer); 1178 str = DoubleToCString(value_->Number(), buffer);
1179 } 1179 }
1180 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); 1180 return isolate_->factory()->NewStringFromAscii(CStrVector(str));
1181 } 1181 }
1182 1182
1183 1183
1184 } } // namespace v8::internal 1184 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698