| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "ast.h" | 30 #include "ast.h" |
| 31 #include "jump-target-inl.h" | |
| 32 #include "parser.h" | 31 #include "parser.h" |
| 33 #include "scopes.h" | 32 #include "scopes.h" |
| 34 #include "string-stream.h" | 33 #include "string-stream.h" |
| 34 #include "type-info.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 AstSentinels::AstSentinels() | 39 AstSentinels::AstSentinels() |
| 40 : this_proxy_(true), | 40 : this_proxy_(true), |
| 41 identifier_proxy_(false), | 41 identifier_proxy_(false), |
| 42 valid_left_hand_side_sentinel_(), | 42 valid_left_hand_side_sentinel_(), |
| 43 this_property_(&this_proxy_, NULL, 0), | 43 this_property_(&this_proxy_, NULL, 0), |
| 44 call_sentinel_(NULL, NULL, 0) { | 44 call_sentinel_(NULL, NULL, 0) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 if (table->Lookup(key, hash, false) != NULL) { | 284 if (table->Lookup(key, hash, false) != NULL) { |
| 285 property->set_emit_store(false); | 285 property->set_emit_store(false); |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 // Add key to the table. | 288 // Add key to the table. |
| 289 table->Lookup(key, hash, true); | 289 table->Lookup(key, hash, true); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 | 293 |
| 294 void TargetCollector::AddTarget(BreakTarget* target) { | 294 void TargetCollector::AddTarget(Label* target) { |
| 295 // Add the label to the collector, but discard duplicates. | 295 // Add the label to the collector, but discard duplicates. |
| 296 int length = targets_->length(); | 296 int length = targets_->length(); |
| 297 for (int i = 0; i < length; i++) { | 297 for (int i = 0; i < length; i++) { |
| 298 if (targets_->at(i) == target) return; | 298 if (targets_->at(i) == target) return; |
| 299 } | 299 } |
| 300 targets_->Add(target); | 300 targets_->Add(target); |
| 301 } | 301 } |
| 302 | 302 |
| 303 | 303 |
| 304 bool Expression::GuaranteedSmiResult() { | 304 bool Expression::GuaranteedSmiResult() { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 break; | 361 break; |
| 362 } | 362 } |
| 363 default: | 363 default: |
| 364 UNREACHABLE(); | 364 UNREACHABLE(); |
| 365 break; | 365 break; |
| 366 } | 366 } |
| 367 return false; | 367 return false; |
| 368 } | 368 } |
| 369 | 369 |
| 370 | 370 |
| 371 void Expression::CopyAnalysisResultsFrom(Expression* other) { | |
| 372 bitfields_ = other->bitfields_; | |
| 373 type_ = other->type_; | |
| 374 } | |
| 375 | |
| 376 | |
| 377 bool UnaryOperation::ResultOverwriteAllowed() { | 371 bool UnaryOperation::ResultOverwriteAllowed() { |
| 378 switch (op_) { | 372 switch (op_) { |
| 379 case Token::BIT_NOT: | 373 case Token::BIT_NOT: |
| 380 case Token::SUB: | 374 case Token::SUB: |
| 381 return true; | 375 return true; |
| 382 default: | 376 default: |
| 383 return false; | 377 return false; |
| 384 } | 378 } |
| 385 } | 379 } |
| 386 | 380 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 409 return false; | 403 return false; |
| 410 } | 404 } |
| 411 | 405 |
| 412 | 406 |
| 413 BinaryOperation::BinaryOperation(Assignment* assignment) { | 407 BinaryOperation::BinaryOperation(Assignment* assignment) { |
| 414 ASSERT(assignment->is_compound()); | 408 ASSERT(assignment->is_compound()); |
| 415 op_ = assignment->binary_op(); | 409 op_ = assignment->binary_op(); |
| 416 left_ = assignment->target(); | 410 left_ = assignment->target(); |
| 417 right_ = assignment->value(); | 411 right_ = assignment->value(); |
| 418 pos_ = assignment->position(); | 412 pos_ = assignment->position(); |
| 419 CopyAnalysisResultsFrom(assignment); | |
| 420 } | 413 } |
| 421 | 414 |
| 422 | 415 |
| 423 // ---------------------------------------------------------------------------- | 416 // ---------------------------------------------------------------------------- |
| 424 // Inlining support | 417 // Inlining support |
| 425 | 418 |
| 426 bool Block::IsInlineable() const { | 419 bool Block::IsInlineable() const { |
| 427 const int count = statements_.length(); | 420 const int count = statements_.length(); |
| 428 for (int i = 0; i < count; ++i) { | 421 for (int i = 0; i < count; ++i) { |
| 429 if (!statements_[i]->IsInlineable()) return false; | 422 if (!statements_[i]->IsInlineable()) return false; |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 ZoneList<Statement*>* statements, | 1062 ZoneList<Statement*>* statements, |
| 1070 int pos) | 1063 int pos) |
| 1071 : label_(label), | 1064 : label_(label), |
| 1072 statements_(statements), | 1065 statements_(statements), |
| 1073 position_(pos), | 1066 position_(pos), |
| 1074 compare_type_(NONE), | 1067 compare_type_(NONE), |
| 1075 entry_id_(AstNode::GetNextId()) { | 1068 entry_id_(AstNode::GetNextId()) { |
| 1076 } | 1069 } |
| 1077 | 1070 |
| 1078 } } // namespace v8::internal | 1071 } } // namespace v8::internal |
| OLD | NEW |