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

Side by Side Diff: src/variables.cc

Issue 9615009: Basic interface inference for modules. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Eps. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « src/variables.h ('k') | test/mjsunit/harmony/module-parsing.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 UNREACHABLE(); 52 UNREACHABLE();
53 return NULL; 53 return NULL;
54 } 54 }
55 55
56 56
57 Variable::Variable(Scope* scope, 57 Variable::Variable(Scope* scope,
58 Handle<String> name, 58 Handle<String> name,
59 VariableMode mode, 59 VariableMode mode,
60 bool is_valid_LHS, 60 bool is_valid_LHS,
61 Kind kind, 61 Kind kind,
62 InitializationFlag initialization_flag) 62 InitializationFlag initialization_flag,
63 Interface* interface)
63 : scope_(scope), 64 : scope_(scope),
64 name_(name), 65 name_(name),
65 mode_(mode), 66 mode_(mode),
66 kind_(kind), 67 kind_(kind),
67 location_(UNALLOCATED), 68 location_(UNALLOCATED),
68 index_(-1), 69 index_(-1),
69 initializer_position_(RelocInfo::kNoPosition), 70 initializer_position_(RelocInfo::kNoPosition),
70 local_if_not_shadowed_(NULL), 71 local_if_not_shadowed_(NULL),
71 is_valid_LHS_(is_valid_LHS), 72 is_valid_LHS_(is_valid_LHS),
72 force_context_allocation_(false), 73 force_context_allocation_(false),
73 is_used_(false), 74 is_used_(false),
74 initialization_flag_(initialization_flag) { 75 initialization_flag_(initialization_flag),
76 interface_(interface) {
75 // Names must be canonicalized for fast equality checks. 77 // Names must be canonicalized for fast equality checks.
76 ASSERT(name->IsSymbol()); 78 ASSERT(name->IsSymbol());
77 // Var declared variables never need initialization. 79 // Var declared variables never need initialization.
78 ASSERT(!(mode == VAR && initialization_flag == kNeedsInitialization)); 80 ASSERT(!(mode == VAR && initialization_flag == kNeedsInitialization));
79 } 81 }
80 82
81 83
82 bool Variable::is_global() const { 84 bool Variable::is_global() const {
83 // Temporaries are never global, they must always be allocated in the 85 // Temporaries are never global, they must always be allocated in the
84 // activation frame. 86 // activation frame.
85 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); 87 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope();
86 } 88 }
87 89
88 90
89 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { 91 int Variable::CompareIndex(Variable* const* v, Variable* const* w) {
90 int x = (*v)->index(); 92 int x = (*v)->index();
91 int y = (*w)->index(); 93 int y = (*w)->index();
92 // Consider sorting them according to type as well? 94 // Consider sorting them according to type as well?
93 return x - y; 95 return x - y;
94 } 96 }
95 97
96 } } // namespace v8::internal 98 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/variables.h ('k') | test/mjsunit/harmony/module-parsing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698