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

Side by Side Diff: src/objects.cc

Issue 2250703003: There are only 2 language modes, not 3 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
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 9140 matching lines...) Expand 10 before | Expand all | Expand 10 after
9151 // using |strict_function_transition_symbol| as a key. 9151 // using |strict_function_transition_symbol| as a key.
9152 if (language_mode == SLOPPY) return initial_map; 9152 if (language_mode == SLOPPY) return initial_map;
9153 Isolate* isolate = initial_map->GetIsolate(); 9153 Isolate* isolate = initial_map->GetIsolate();
9154 Factory* factory = isolate->factory(); 9154 Factory* factory = isolate->factory();
9155 Handle<Symbol> transition_symbol; 9155 Handle<Symbol> transition_symbol;
9156 9156
9157 int map_index = Context::FunctionMapIndex(language_mode, kind); 9157 int map_index = Context::FunctionMapIndex(language_mode, kind);
9158 Handle<Map> function_map( 9158 Handle<Map> function_map(
9159 Map::cast(isolate->native_context()->get(map_index))); 9159 Map::cast(isolate->native_context()->get(map_index)));
9160 9160
9161 STATIC_ASSERT(LANGUAGE_END == 3); 9161 STATIC_ASSERT(LANGUAGE_END == 2);
9162 switch (language_mode) { 9162 switch (language_mode) {
9163 case STRICT: 9163 case STRICT:
9164 transition_symbol = factory->strict_function_transition_symbol(); 9164 transition_symbol = factory->strict_function_transition_symbol();
9165 break; 9165 break;
9166 default: 9166 default:
9167 UNREACHABLE(); 9167 UNREACHABLE();
9168 break; 9168 break;
9169 } 9169 }
neis 2016/08/17 16:47:34 Maybe get rid of the switch.
9170 Map* maybe_transition = 9170 Map* maybe_transition =
9171 TransitionArray::SearchSpecial(*initial_map, *transition_symbol); 9171 TransitionArray::SearchSpecial(*initial_map, *transition_symbol);
9172 if (maybe_transition != NULL) { 9172 if (maybe_transition != NULL) {
9173 return handle(maybe_transition, isolate); 9173 return handle(maybe_transition, isolate);
9174 } 9174 }
9175 initial_map->NotifyLeafMapLayoutChange(); 9175 initial_map->NotifyLeafMapLayoutChange();
9176 9176
9177 // Create new map taking descriptors from the |function_map| and all 9177 // Create new map taking descriptors from the |function_map| and all
9178 // the other details from the |initial_map|. 9178 // the other details from the |initial_map|.
9179 Handle<Map> map = 9179 Handle<Map> map =
(...skipping 7431 matching lines...) Expand 10 before | Expand all | Expand 10 after
16611 int scope_position) { 16611 int scope_position) {
16612 uint32_t hash = source->Hash(); 16612 uint32_t hash = source->Hash();
16613 if (shared->HasSourceCode()) { 16613 if (shared->HasSourceCode()) {
16614 // Instead of using the SharedFunctionInfo pointer in the hash 16614 // Instead of using the SharedFunctionInfo pointer in the hash
16615 // code computation, we use a combination of the hash of the 16615 // code computation, we use a combination of the hash of the
16616 // script source code and the start position of the calling scope. 16616 // script source code and the start position of the calling scope.
16617 // We do this to ensure that the cache entries can survive garbage 16617 // We do this to ensure that the cache entries can survive garbage
16618 // collection. 16618 // collection.
16619 Script* script(Script::cast(shared->script())); 16619 Script* script(Script::cast(shared->script()));
16620 hash ^= String::cast(script->source())->Hash(); 16620 hash ^= String::cast(script->source())->Hash();
16621 STATIC_ASSERT(LANGUAGE_END == 3); 16621 STATIC_ASSERT(LANGUAGE_END == 2);
16622 if (is_strict(language_mode)) hash ^= 0x8000; 16622 if (is_strict(language_mode)) hash ^= 0x8000;
16623 hash += scope_position; 16623 hash += scope_position;
16624 } 16624 }
16625 return hash; 16625 return hash;
16626 } 16626 }
16627 16627
16628 uint32_t Hash() override { 16628 uint32_t Hash() override {
16629 return StringSharedHashHelper(*source_, *shared_, language_mode_, 16629 return StringSharedHashHelper(*source_, *shared_, language_mode_,
16630 scope_position_); 16630 scope_position_);
16631 } 16631 }
(...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after
19874 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, 19874 for (PrototypeIterator iter(isolate, this, kStartAtReceiver,
19875 PrototypeIterator::END_AT_NULL); 19875 PrototypeIterator::END_AT_NULL);
19876 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { 19876 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) {
19877 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; 19877 if (iter.GetCurrent<Object>()->IsJSProxy()) return true;
19878 } 19878 }
19879 return false; 19879 return false;
19880 } 19880 }
19881 19881
19882 } // namespace internal 19882 } // namespace internal
19883 } // namespace v8 19883 } // namespace v8
OLDNEW
« src/objects.h ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698