| 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 #ifndef V8_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
| 6 #define V8_HYDROGEN_H_ | 6 #define V8_HYDROGEN_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2459 bool CanAccessMonomorphic(); | 2459 bool CanAccessMonomorphic(); |
| 2460 | 2460 |
| 2461 // Checks whether all types behave uniform when loading name. If all maps | 2461 // Checks whether all types behave uniform when loading name. If all maps |
| 2462 // behave the same, a single monomorphic load instruction can be emitted, | 2462 // behave the same, a single monomorphic load instruction can be emitted, |
| 2463 // guarded by a single map-checks instruction that whether the receiver is | 2463 // guarded by a single map-checks instruction that whether the receiver is |
| 2464 // an instance of any of the types. | 2464 // an instance of any of the types. |
| 2465 // This method skips the first type in types, assuming that this | 2465 // This method skips the first type in types, assuming that this |
| 2466 // PropertyAccessInfo is built for types->first(). | 2466 // PropertyAccessInfo is built for types->first(). |
| 2467 bool CanAccessAsMonomorphic(SmallMapList* types); | 2467 bool CanAccessAsMonomorphic(SmallMapList* types); |
| 2468 | 2468 |
| 2469 Handle<Map> map() { | 2469 Handle<Map> map(); |
| 2470 if (type_->Is(Type::Number())) { | |
| 2471 Context* context = current_info()->closure()->context(); | |
| 2472 context = context->native_context(); | |
| 2473 return handle(context->number_function()->initial_map()); | |
| 2474 } else if (type_->Is(Type::Boolean())) { | |
| 2475 Context* context = current_info()->closure()->context(); | |
| 2476 context = context->native_context(); | |
| 2477 return handle(context->boolean_function()->initial_map()); | |
| 2478 } else if (type_->Is(Type::String())) { | |
| 2479 Context* context = current_info()->closure()->context(); | |
| 2480 context = context->native_context(); | |
| 2481 return handle(context->string_function()->initial_map()); | |
| 2482 } else { | |
| 2483 return type_->AsClass()->Map(); | |
| 2484 } | |
| 2485 } | |
| 2486 Type* type() const { return type_; } | 2470 Type* type() const { return type_; } |
| 2487 Handle<String> name() const { return name_; } | 2471 Handle<String> name() const { return name_; } |
| 2488 | 2472 |
| 2489 bool IsJSObjectFieldAccessor() { | 2473 bool IsJSObjectFieldAccessor() { |
| 2490 int offset; // unused | 2474 int offset; // unused |
| 2491 return Accessors::IsJSObjectFieldAccessor<Type>(type_, name_, &offset); | 2475 return Accessors::IsJSObjectFieldAccessor<Type>(type_, name_, &offset); |
| 2492 } | 2476 } |
| 2493 | 2477 |
| 2494 bool GetJSObjectFieldAccess(HObjectAccess* access) { | 2478 bool GetJSObjectFieldAccess(HObjectAccess* access) { |
| 2495 int offset; | 2479 int offset; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 } | 2891 } |
| 2908 | 2892 |
| 2909 private: | 2893 private: |
| 2910 HGraphBuilder* builder_; | 2894 HGraphBuilder* builder_; |
| 2911 }; | 2895 }; |
| 2912 | 2896 |
| 2913 | 2897 |
| 2914 } } // namespace v8::internal | 2898 } } // namespace v8::internal |
| 2915 | 2899 |
| 2916 #endif // V8_HYDROGEN_H_ | 2900 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |