| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 if (expression()->AsSuperReference() != NULL) return SUPER_CALL; | 618 if (expression()->AsSuperReference() != NULL) return SUPER_CALL; |
| 619 | 619 |
| 620 Property* property = expression()->AsProperty(); | 620 Property* property = expression()->AsProperty(); |
| 621 return property != NULL ? PROPERTY_CALL : OTHER_CALL; | 621 return property != NULL ? PROPERTY_CALL : OTHER_CALL; |
| 622 } | 622 } |
| 623 | 623 |
| 624 | 624 |
| 625 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, | 625 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, |
| 626 LookupIterator* it) { | 626 LookupIterator* it) { |
| 627 target_ = Handle<JSFunction>::null(); | 627 target_ = Handle<JSFunction>::null(); |
| 628 cell_ = Handle<Cell>::null(); | |
| 629 DCHECK(it->IsFound() && it->GetHolder<JSObject>().is_identical_to(global)); | 628 DCHECK(it->IsFound() && it->GetHolder<JSObject>().is_identical_to(global)); |
| 630 cell_ = it->GetPropertyCell(); | 629 Handle<PropertyCell> cell = it->GetPropertyCell(); |
| 631 if (cell_->value()->IsJSFunction()) { | 630 if (cell->value()->IsJSFunction()) { |
| 632 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); | 631 Handle<JSFunction> candidate(JSFunction::cast(cell->value())); |
| 633 // If the function is in new space we assume it's more likely to | 632 // If the function is in new space we assume it's more likely to |
| 634 // change and thus prefer the general IC code. | 633 // change and thus prefer the general IC code. |
| 635 if (!it->isolate()->heap()->InNewSpace(*candidate)) { | 634 if (!it->isolate()->heap()->InNewSpace(*candidate)) { |
| 636 target_ = candidate; | 635 target_ = candidate; |
| 637 return true; | 636 return true; |
| 638 } | 637 } |
| 639 } | 638 } |
| 640 return false; | 639 return false; |
| 641 } | 640 } |
| 642 | 641 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 // static | 1018 // static |
| 1020 bool Literal::Match(void* literal1, void* literal2) { | 1019 bool Literal::Match(void* literal1, void* literal2) { |
| 1021 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1020 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 1022 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1021 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 1023 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1022 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
| 1024 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1023 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 1025 } | 1024 } |
| 1026 | 1025 |
| 1027 | 1026 |
| 1028 } } // namespace v8::internal | 1027 } } // namespace v8::internal |
| OLD | NEW |