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

Side by Side Diff: arguments/src/variables.cc

Issue 6665067: [Arguments] Remove synthetic properties and all code dealing with them. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental
Patch Set: Created 9 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL"; 63 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL";
64 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL"; 64 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL";
65 case INTERNAL: return "INTERNAL"; 65 case INTERNAL: return "INTERNAL";
66 case TEMPORARY: return "TEMPORARY"; 66 case TEMPORARY: return "TEMPORARY";
67 } 67 }
68 UNREACHABLE(); 68 UNREACHABLE();
69 return NULL; 69 return NULL;
70 } 70 }
71 71
72 72
73 Property* Variable::AsProperty() const { 73 Slot* Variable::AsSlot() const { return rewrite_; }
74 return rewrite_ == NULL ? NULL : rewrite_->AsProperty();
75 }
76
77
78 Slot* Variable::AsSlot() const {
79 return rewrite_ == NULL ? NULL : rewrite_->AsSlot();
80 }
81 74
82 75
83 bool Variable::IsStackAllocated() const { 76 bool Variable::IsStackAllocated() const {
84 Slot* slot = AsSlot(); 77 return rewrite_ != NULL && rewrite_->IsStackAllocated();
85 return slot != NULL && slot->IsStackAllocated();
86 } 78 }
87 79
88 80
89 bool Variable::IsParameter() const { 81 bool Variable::IsParameter() const {
90 Slot* s = AsSlot(); 82 return rewrite_ != NULL && rewrite_->type() == Slot::PARAMETER;
91 return s != NULL && s->type() == Slot::PARAMETER;
92 } 83 }
93 84
94 85
95 bool Variable::IsStackLocal() const { 86 bool Variable::IsStackLocal() const {
96 Slot* s = AsSlot(); 87 return rewrite_ != NULL && rewrite_->type() == Slot::LOCAL;
97 return s != NULL && s->type() == Slot::LOCAL;
98 } 88 }
99 89
100 90
101 bool Variable::IsContextSlot() const { 91 bool Variable::IsContextSlot() const {
102 Slot* s = AsSlot(); 92 return rewrite_ != NULL && rewrite_->type() == Slot::CONTEXT;
103 return s != NULL && s->type() == Slot::CONTEXT;
104 } 93 }
105 94
106 95
107 Variable::Variable(Scope* scope, 96 Variable::Variable(Scope* scope,
108 Handle<String> name, 97 Handle<String> name,
109 Mode mode, 98 Mode mode,
110 bool is_valid_LHS, 99 bool is_valid_LHS,
111 Kind kind) 100 Kind kind)
112 : scope_(scope), 101 : scope_(scope),
113 name_(name), 102 name_(name),
114 mode_(mode), 103 mode_(mode),
115 kind_(kind), 104 kind_(kind),
116 local_if_not_shadowed_(NULL), 105 local_if_not_shadowed_(NULL),
117 rewrite_(NULL), 106 rewrite_(NULL),
118 is_valid_LHS_(is_valid_LHS), 107 is_valid_LHS_(is_valid_LHS),
119 is_accessed_from_inner_scope_(false), 108 is_accessed_from_inner_scope_(false),
120 is_used_(false) { 109 is_used_(false) {
121 // names must be canonicalized for fast equality checks 110 // names must be canonicalized for fast equality checks
122 ASSERT(name->IsSymbol()); 111 ASSERT(name->IsSymbol());
123 } 112 }
124 113
125 114
126 bool Variable::is_global() const { 115 bool Variable::is_global() const {
127 // Temporaries are never global, they must always be allocated in the 116 // Temporaries are never global, they must always be allocated in the
128 // activation frame. 117 // activation frame.
129 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); 118 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope();
130 } 119 }
131 120
132 } } // namespace v8::internal 121 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698