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

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: Latest 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
« no previous file with comments | « src/compiler/typer.h ('k') | src/hydrogen-instructions.h » ('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 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 class Typer::Decorator final : public GraphDecorator { 169 class Typer::Decorator final : public GraphDecorator {
170 public: 170 public:
171 explicit Decorator(Typer* typer) : typer_(typer) {} 171 explicit Decorator(Typer* typer) : typer_(typer) {}
172 void Decorate(Node* node) final; 172 void Decorate(Node* node) final;
173 173
174 private: 174 private:
175 Typer* typer_; 175 Typer* typer_;
176 }; 176 };
177 177
178 178
179 Typer::Typer(Isolate* isolate, Graph* graph, MaybeHandle<Context> context) 179 Typer::Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type,
180 MaybeHandle<Context> context)
180 : isolate_(isolate), 181 : isolate_(isolate),
181 graph_(graph), 182 graph_(graph),
183 function_type_(function_type),
182 context_(context), 184 context_(context),
183 decorator_(NULL), 185 decorator_(NULL),
184 cache_(new (graph->zone()) LazyTypeCache(isolate, graph->zone())) { 186 cache_(new (graph->zone()) LazyTypeCache(isolate, graph->zone())) {
185 Zone* zone = this->zone(); 187 Zone* zone = this->zone();
186 Factory* const factory = isolate->factory(); 188 Factory* const factory = isolate->factory();
187 189
188 Type* infinity = Type::Constant(factory->infinity_value(), zone); 190 Type* infinity = Type::Constant(factory->infinity_value(), zone);
189 Type* minus_infinity = Type::Constant(factory->minus_infinity_value(), zone); 191 Type* minus_infinity = Type::Constant(factory->minus_infinity_value(), zone);
190 Type* truncating_to_zero = 192 Type* truncating_to_zero =
191 Type::Union(Type::Union(infinity, minus_infinity, zone), 193 Type::Union(Type::Union(infinity, minus_infinity, zone),
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 629
628 Bounds Typer::Visitor::TypeIfException(Node* node) { 630 Bounds Typer::Visitor::TypeIfException(Node* node) {
629 return Bounds::Unbounded(zone()); 631 return Bounds::Unbounded(zone());
630 } 632 }
631 633
632 634
633 // Common operators. 635 // Common operators.
634 636
635 637
636 Bounds Typer::Visitor::TypeParameter(Node* node) { 638 Bounds Typer::Visitor::TypeParameter(Node* node) {
639 int param = OpParameter<int>(node);
640 Type::FunctionType* function_type = typer_->function_type();
641 if (function_type != nullptr && param >= 0 &&
642 param < static_cast<int>(function_type->Arity())) {
643 return Bounds(Type::None(), function_type->Parameter(param));
644 }
637 return Bounds::Unbounded(zone()); 645 return Bounds::Unbounded(zone());
638 } 646 }
639 647
640 648
641 Bounds Typer::Visitor::TypeOsrValue(Node* node) { 649 Bounds Typer::Visitor::TypeOsrValue(Node* node) {
642 if (node->InputAt(0)->opcode() == IrOpcode::kOsrLoopEntry) { 650 if (node->InputAt(0)->opcode() == IrOpcode::kOsrLoopEntry) {
643 // Before deconstruction, OSR values have type {None} to avoid polluting 651 // Before deconstruction, OSR values have type {None} to avoid polluting
644 // the types of phis and other nodes in the graph. 652 // the types of phis and other nodes in the graph.
645 return Bounds(Type::None(), Type::None()); 653 return Bounds(Type::None(), Type::None());
646 } 654 }
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 TYPED_ARRAYS(TYPED_ARRAY_CASE) 2429 TYPED_ARRAYS(TYPED_ARRAY_CASE)
2422 #undef TYPED_ARRAY_CASE 2430 #undef TYPED_ARRAY_CASE
2423 } 2431 }
2424 } 2432 }
2425 return Type::Constant(value, zone()); 2433 return Type::Constant(value, zone());
2426 } 2434 }
2427 2435
2428 } // namespace compiler 2436 } // namespace compiler
2429 } // namespace internal 2437 } // namespace internal
2430 } // namespace v8 2438 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/typer.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698