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

Side by Side Diff: src/compiler/typer.cc

Issue 1197703002: Use big-boy Types to annotate interface descriptor parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/base/flags.h" 5 #include "src/base/flags.h"
6 #include "src/bootstrapper.h" 6 #include "src/bootstrapper.h"
7 #include "src/compiler/graph-reducer.h" 7 #include "src/compiler/graph-reducer.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 class Typer::Decorator final : public GraphDecorator { 157 class Typer::Decorator final : public GraphDecorator {
158 public: 158 public:
159 explicit Decorator(Typer* typer) : typer_(typer) {} 159 explicit Decorator(Typer* typer) : typer_(typer) {}
160 void Decorate(Node* node) final; 160 void Decorate(Node* node) final;
161 161
162 private: 162 private:
163 Typer* typer_; 163 Typer* typer_;
164 }; 164 };
165 165
166 166
167 Typer::Typer(Isolate* isolate, Graph* graph, MaybeHandle<Context> context) 167 Typer::Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type,
168 MaybeHandle<Context> context)
168 : isolate_(isolate), 169 : isolate_(isolate),
169 graph_(graph), 170 graph_(graph),
171 function_type_(function_type),
170 context_(context), 172 context_(context),
171 decorator_(NULL), 173 decorator_(NULL),
172 cache_(new (graph->zone()) LazyTypeCache(isolate, graph->zone())) { 174 cache_(new (graph->zone()) LazyTypeCache(isolate, graph->zone())) {
173 Zone* zone = this->zone(); 175 Zone* zone = this->zone();
174 Factory* f = isolate->factory(); 176 Factory* f = isolate->factory();
175 177
176 Handle<Object> infinity = f->NewNumber(+V8_INFINITY); 178 Handle<Object> infinity = f->NewNumber(+V8_INFINITY);
177 Handle<Object> minusinfinity = f->NewNumber(-V8_INFINITY); 179 Handle<Object> minusinfinity = f->NewNumber(-V8_INFINITY);
178 180
179 Type* number = Type::Number(); 181 Type* number = Type::Number();
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 636
635 Bounds Typer::Visitor::TypeIfException(Node* node) { 637 Bounds Typer::Visitor::TypeIfException(Node* node) {
636 return Bounds::Unbounded(zone()); 638 return Bounds::Unbounded(zone());
637 } 639 }
638 640
639 641
640 // Common operators. 642 // Common operators.
641 643
642 644
643 Bounds Typer::Visitor::TypeParameter(Node* node) { 645 Bounds Typer::Visitor::TypeParameter(Node* node) {
646 int param = OpParameter<int>(node);
647 Type::FunctionType* function_type = typer_->function_type();
648 if (function_type != nullptr && param >= 0 &&
649 param < static_cast<int>(function_type->Arity())) {
650 return Bounds(Type::None(), function_type->Parameter(param));
651 }
644 return Bounds::Unbounded(zone()); 652 return Bounds::Unbounded(zone());
645 } 653 }
646 654
647 655
648 Bounds Typer::Visitor::TypeOsrValue(Node* node) { 656 Bounds Typer::Visitor::TypeOsrValue(Node* node) {
649 if (node->InputAt(0)->opcode() == IrOpcode::kOsrLoopEntry) { 657 if (node->InputAt(0)->opcode() == IrOpcode::kOsrLoopEntry) {
650 // Before deconstruction, OSR values have type {None} to avoid polluting 658 // Before deconstruction, OSR values have type {None} to avoid polluting
651 // the types of phis and other nodes in the graph. 659 // the types of phis and other nodes in the graph.
652 return Bounds(Type::None(), Type::None()); 660 return Bounds(Type::None(), Type::None());
653 } 661 }
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 TYPED_ARRAYS(TYPED_ARRAY_CASE) 2437 TYPED_ARRAYS(TYPED_ARRAY_CASE)
2430 #undef TYPED_ARRAY_CASE 2438 #undef TYPED_ARRAY_CASE
2431 } 2439 }
2432 } 2440 }
2433 return Type::Constant(value, zone()); 2441 return Type::Constant(value, zone());
2434 } 2442 }
2435 2443
2436 } // namespace compiler 2444 } // namespace compiler
2437 } // namespace internal 2445 } // namespace internal
2438 } // namespace v8 2446 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698