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/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/api.h" | 6 #include "src/api.h" |
7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/code-events.h" | 8 #include "src/code-events.h" |
9 #include "src/compiler/code-assembler.h" | 9 #include "src/compiler/code-assembler.h" |
10 #include "src/ic/ic-state.h" | 10 #include "src/ic/ic-state.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // may be called during initialization (disassembler!) | 196 // may be called during initialization (disassembler!) |
197 if (initialized_) { | 197 if (initialized_) { |
198 for (int i = 0; i < builtin_count; i++) { | 198 for (int i = 0; i < builtin_count; i++) { |
199 Code* entry = Code::cast(builtins_[i]); | 199 Code* entry = Code::cast(builtins_[i]); |
200 if (entry->contains(pc)) return name(i); | 200 if (entry->contains(pc)) return name(i); |
201 } | 201 } |
202 } | 202 } |
203 return NULL; | 203 return NULL; |
204 } | 204 } |
205 | 205 |
| 206 Handle<Code> Builtins::NewFunctionContext(ScopeType scope_type) { |
| 207 switch (scope_type) { |
| 208 case ScopeType::EVAL_SCOPE: |
| 209 return FastNewFunctionContextEval(); |
| 210 case ScopeType::FUNCTION_SCOPE: |
| 211 return FastNewFunctionContextFunction(); |
| 212 default: |
| 213 UNREACHABLE(); |
| 214 } |
| 215 return Handle<Code>::null(); |
| 216 } |
| 217 |
| 218 Handle<Code> Builtins::NewCloneShallowArray( |
| 219 AllocationSiteMode allocation_mode) { |
| 220 switch (allocation_mode) { |
| 221 case TRACK_ALLOCATION_SITE: |
| 222 return FastCloneShallowArrayTrack(); |
| 223 case DONT_TRACK_ALLOCATION_SITE: |
| 224 return FastCloneShallowArrayDontTrack(); |
| 225 default: |
| 226 UNREACHABLE(); |
| 227 } |
| 228 return Handle<Code>::null(); |
| 229 } |
| 230 |
| 231 Handle<Code> Builtins::NewCloneShallowObject(int length) { |
| 232 switch (length) { |
| 233 case 0: |
| 234 return FastCloneShallowObject0(); |
| 235 case 1: |
| 236 return FastCloneShallowObject1(); |
| 237 case 2: |
| 238 return FastCloneShallowObject2(); |
| 239 case 3: |
| 240 return FastCloneShallowObject3(); |
| 241 case 4: |
| 242 return FastCloneShallowObject4(); |
| 243 case 5: |
| 244 return FastCloneShallowObject5(); |
| 245 case 6: |
| 246 return FastCloneShallowObject6(); |
| 247 default: |
| 248 UNREACHABLE(); |
| 249 } |
| 250 return Handle<Code>::null(); |
| 251 } |
| 252 |
| 253 Handle<Code> Builtins::NonPrimitiveToPrimitive(ToPrimitiveHint hint) { |
| 254 switch (hint) { |
| 255 case ToPrimitiveHint::kDefault: |
| 256 return NonPrimitiveToPrimitive_Default(); |
| 257 case ToPrimitiveHint::kNumber: |
| 258 return NonPrimitiveToPrimitive_Number(); |
| 259 case ToPrimitiveHint::kString: |
| 260 return NonPrimitiveToPrimitive_String(); |
| 261 } |
| 262 UNREACHABLE(); |
| 263 return Handle<Code>::null(); |
| 264 } |
| 265 |
| 266 Handle<Code> Builtins::OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint) { |
| 267 switch (hint) { |
| 268 case OrdinaryToPrimitiveHint::kNumber: |
| 269 return OrdinaryToPrimitive_Number(); |
| 270 case OrdinaryToPrimitiveHint::kString: |
| 271 return OrdinaryToPrimitive_String(); |
| 272 } |
| 273 UNREACHABLE(); |
| 274 return Handle<Code>::null(); |
| 275 } |
| 276 |
206 // static | 277 // static |
207 const char* Builtins::name(int index) { | 278 const char* Builtins::name(int index) { |
208 switch (index) { | 279 switch (index) { |
209 #define CASE(Name, ...) \ | 280 #define CASE(Name, ...) \ |
210 case k##Name: \ | 281 case k##Name: \ |
211 return #Name; | 282 return #Name; |
212 BUILTIN_LIST_ALL(CASE) | 283 BUILTIN_LIST_ALL(CASE) |
213 #undef CASE | 284 #undef CASE |
214 default: | 285 default: |
215 UNREACHABLE(); | 286 UNREACHABLE(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // TODO(jochen): Remove this. | 376 // TODO(jochen): Remove this. |
306 if (responsible_context.is_null()) { | 377 if (responsible_context.is_null()) { |
307 return true; | 378 return true; |
308 } | 379 } |
309 if (*responsible_context == target->context()) return true; | 380 if (*responsible_context == target->context()) return true; |
310 return isolate->MayAccess(responsible_context, target_global_proxy); | 381 return isolate->MayAccess(responsible_context, target_global_proxy); |
311 } | 382 } |
312 | 383 |
313 } // namespace internal | 384 } // namespace internal |
314 } // namespace v8 | 385 } // namespace v8 |
OLD | NEW |