OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast.h" | 5 #include "src/ast.h" |
6 | 6 |
7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
8 #include "src/builtins.h" | 8 #include "src/builtins.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 return AsArrayLiteral()->BuildConstantElements(isolate); | 410 return AsArrayLiteral()->BuildConstantElements(isolate); |
411 } | 411 } |
412 if (IsObjectLiteral()) { | 412 if (IsObjectLiteral()) { |
413 return AsObjectLiteral()->BuildConstantProperties(isolate); | 413 return AsObjectLiteral()->BuildConstantProperties(isolate); |
414 } | 414 } |
415 DCHECK(IsRegExpLiteral()); | 415 DCHECK(IsRegExpLiteral()); |
416 DCHECK(depth() >= 1); // Depth should be initialized. | 416 DCHECK(depth() >= 1); // Depth should be initialized. |
417 } | 417 } |
418 | 418 |
419 | 419 |
420 void TargetCollector::AddTarget(Label* target, Zone* zone) { | |
421 // Add the label to the collector, but discard duplicates. | |
422 int length = targets_.length(); | |
423 for (int i = 0; i < length; i++) { | |
424 if (targets_[i] == target) return; | |
425 } | |
426 targets_.Add(target, zone); | |
427 } | |
428 | |
429 | |
430 void UnaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { | 420 void UnaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { |
431 // TODO(olivf) If this Operation is used in a test context, then the | 421 // TODO(olivf) If this Operation is used in a test context, then the |
432 // expression has a ToBoolean stub and we want to collect the type | 422 // expression has a ToBoolean stub and we want to collect the type |
433 // information. However the GraphBuilder expects it to be on the instruction | 423 // information. However the GraphBuilder expects it to be on the instruction |
434 // corresponding to the TestContext, therefore we have to store it here and | 424 // corresponding to the TestContext, therefore we have to store it here and |
435 // not on the operand. | 425 // not on the operand. |
436 set_to_boolean_types(oracle->ToBooleanTypes(expression()->test_id())); | 426 set_to_boolean_types(oracle->ToBooleanTypes(expression()->test_id())); |
437 } | 427 } |
438 | 428 |
439 | 429 |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 // static | 1016 // static |
1027 bool Literal::Match(void* literal1, void* literal2) { | 1017 bool Literal::Match(void* literal1, void* literal2) { |
1028 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1018 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1029 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1019 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1030 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1020 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
1031 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1021 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1032 } | 1022 } |
1033 | 1023 |
1034 | 1024 |
1035 } } // namespace v8::internal | 1025 } } // namespace v8::internal |
OLD | NEW |