OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 9150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9161 // Initial map for sloppy mode function is stored in the function | 9161 // Initial map for sloppy mode function is stored in the function |
9162 // constructor. Initial maps for strict mode are cached as special transitions | 9162 // constructor. Initial maps for strict mode are cached as special transitions |
9163 // using |strict_function_transition_symbol| as a key. | 9163 // using |strict_function_transition_symbol| as a key. |
9164 if (language_mode == SLOPPY) return initial_map; | 9164 if (language_mode == SLOPPY) return initial_map; |
9165 Isolate* isolate = initial_map->GetIsolate(); | 9165 Isolate* isolate = initial_map->GetIsolate(); |
9166 | 9166 |
9167 int map_index = Context::FunctionMapIndex(language_mode, kind); | 9167 int map_index = Context::FunctionMapIndex(language_mode, kind); |
9168 Handle<Map> function_map( | 9168 Handle<Map> function_map( |
9169 Map::cast(isolate->native_context()->get(map_index))); | 9169 Map::cast(isolate->native_context()->get(map_index))); |
9170 | 9170 |
9171 STATIC_ASSERT(LAST_LANGUAGE_MODE == 1); | 9171 STATIC_ASSERT(LANGUAGE_END == 2); |
9172 DCHECK_EQ(STRICT, language_mode); | 9172 DCHECK_EQ(STRICT, language_mode); |
9173 Handle<Symbol> transition_symbol = | 9173 Handle<Symbol> transition_symbol = |
9174 isolate->factory()->strict_function_transition_symbol(); | 9174 isolate->factory()->strict_function_transition_symbol(); |
9175 Map* maybe_transition = | 9175 Map* maybe_transition = |
9176 TransitionArray::SearchSpecial(*initial_map, *transition_symbol); | 9176 TransitionArray::SearchSpecial(*initial_map, *transition_symbol); |
9177 if (maybe_transition != NULL) { | 9177 if (maybe_transition != NULL) { |
9178 return handle(maybe_transition, isolate); | 9178 return handle(maybe_transition, isolate); |
9179 } | 9179 } |
9180 initial_map->NotifyLeafMapLayoutChange(); | 9180 initial_map->NotifyLeafMapLayoutChange(); |
9181 | 9181 |
(...skipping 6824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16006 int scope_position) { | 16006 int scope_position) { |
16007 uint32_t hash = source->Hash(); | 16007 uint32_t hash = source->Hash(); |
16008 if (shared->HasSourceCode()) { | 16008 if (shared->HasSourceCode()) { |
16009 // Instead of using the SharedFunctionInfo pointer in the hash | 16009 // Instead of using the SharedFunctionInfo pointer in the hash |
16010 // code computation, we use a combination of the hash of the | 16010 // code computation, we use a combination of the hash of the |
16011 // script source code and the start position of the calling scope. | 16011 // script source code and the start position of the calling scope. |
16012 // We do this to ensure that the cache entries can survive garbage | 16012 // We do this to ensure that the cache entries can survive garbage |
16013 // collection. | 16013 // collection. |
16014 Script* script(Script::cast(shared->script())); | 16014 Script* script(Script::cast(shared->script())); |
16015 hash ^= String::cast(script->source())->Hash(); | 16015 hash ^= String::cast(script->source())->Hash(); |
16016 STATIC_ASSERT(LAST_LANGUAGE_MODE == 1); | 16016 STATIC_ASSERT(LANGUAGE_END == 2); |
16017 if (is_strict(language_mode)) hash ^= 0x8000; | 16017 if (is_strict(language_mode)) hash ^= 0x8000; |
16018 hash += scope_position; | 16018 hash += scope_position; |
16019 } | 16019 } |
16020 return hash; | 16020 return hash; |
16021 } | 16021 } |
16022 | 16022 |
16023 uint32_t Hash() override { | 16023 uint32_t Hash() override { |
16024 return StringSharedHashHelper(*source_, *shared_, language_mode_, | 16024 return StringSharedHashHelper(*source_, *shared_, language_mode_, |
16025 scope_position_); | 16025 scope_position_); |
16026 } | 16026 } |
(...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19269 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, | 19269 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, |
19270 PrototypeIterator::END_AT_NULL); | 19270 PrototypeIterator::END_AT_NULL); |
19271 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { | 19271 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { |
19272 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; | 19272 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; |
19273 } | 19273 } |
19274 return false; | 19274 return false; |
19275 } | 19275 } |
19276 | 19276 |
19277 } // namespace internal | 19277 } // namespace internal |
19278 } // namespace v8 | 19278 } // namespace v8 |
OLD | NEW |