OLD | NEW |
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 int FunctionLiteral::end_position() const { | 144 int FunctionLiteral::end_position() const { |
145 return scope()->end_position(); | 145 return scope()->end_position(); |
146 } | 146 } |
147 | 147 |
148 | 148 |
149 StrictMode FunctionLiteral::strict_mode() const { | 149 StrictMode FunctionLiteral::strict_mode() const { |
150 return scope()->strict_mode(); | 150 return scope()->strict_mode(); |
151 } | 151 } |
152 | 152 |
153 | 153 |
| 154 bool FunctionLiteral::needs_super_binding() const { |
| 155 DCHECK_NOT_NULL(scope()); |
| 156 return scope()->uses_super() || scope()->inner_uses_super(); |
| 157 } |
| 158 |
| 159 |
154 void FunctionLiteral::InitializeSharedInfo( | 160 void FunctionLiteral::InitializeSharedInfo( |
155 Handle<Code> unoptimized_code) { | 161 Handle<Code> unoptimized_code) { |
156 for (RelocIterator it(*unoptimized_code); !it.done(); it.next()) { | 162 for (RelocIterator it(*unoptimized_code); !it.done(); it.next()) { |
157 RelocInfo* rinfo = it.rinfo(); | 163 RelocInfo* rinfo = it.rinfo(); |
158 if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue; | 164 if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue; |
159 Object* obj = rinfo->target_object(); | 165 Object* obj = rinfo->target_object(); |
160 if (obj->IsSharedFunctionInfo()) { | 166 if (obj->IsSharedFunctionInfo()) { |
161 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); | 167 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); |
162 if (shared->start_position() == start_position()) { | 168 if (shared->start_position() == start_position()) { |
163 shared_info_ = Handle<SharedFunctionInfo>(shared); | 169 shared_info_ = Handle<SharedFunctionInfo>(shared); |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 // static | 1139 // static |
1134 bool Literal::Match(void* literal1, void* literal2) { | 1140 bool Literal::Match(void* literal1, void* literal2) { |
1135 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1141 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1136 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1142 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1137 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1143 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
1138 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1144 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1139 } | 1145 } |
1140 | 1146 |
1141 | 1147 |
1142 } } // namespace v8::internal | 1148 } } // namespace v8::internal |
OLD | NEW |