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

Side by Side Diff: src/ast.cc

Issue 1023103003: If CallNew targets a constant global, set its state to monomorphic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/ast.h ('k') | src/hydrogen.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 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } 615 }
616 } 616 }
617 617
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,
626 LookupIterator* it) {
627 target_ = Handle<JSFunction>::null();
628 DCHECK(it->IsFound() && it->GetHolder<JSObject>().is_identical_to(global));
629 Handle<PropertyCell> cell = it->GetPropertyCell();
630 if (cell->value()->IsJSFunction()) {
631 Handle<JSFunction> candidate(JSFunction::cast(cell->value()));
632 // If the function is in new space we assume it's more likely to
633 // change and thus prefer the general IC code.
634 if (!it->isolate()->heap()->InNewSpace(*candidate)) {
635 target_ = candidate;
636 return true;
637 }
638 }
639 return false;
640 }
641
642
643 // ---------------------------------------------------------------------------- 625 // ----------------------------------------------------------------------------
644 // Implementation of AstVisitor 626 // Implementation of AstVisitor
645 627
646 void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) { 628 void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) {
647 for (int i = 0; i < declarations->length(); i++) { 629 for (int i = 0; i < declarations->length(); i++) {
648 Visit(declarations->at(i)); 630 Visit(declarations->at(i));
649 } 631 }
650 } 632 }
651 633
652 634
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 // static 1000 // static
1019 bool Literal::Match(void* literal1, void* literal2) { 1001 bool Literal::Match(void* literal1, void* literal2) {
1020 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1002 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1021 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1003 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1022 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || 1004 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) ||
1023 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1005 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1024 } 1006 }
1025 1007
1026 1008
1027 } } // namespace v8::internal 1009 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698