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

Side by Side Diff: src/objects.cc

Issue 1774943002: Install the internalized string as flattened version into cons-strings for fast re-internalization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <sstream> 9 #include <sstream>
10 10
(...skipping 17939 matching lines...) Expand 10 before | Expand all | Expand 10 after
17950 Handle<StringTable> table = isolate->factory()->string_table(); 17950 Handle<StringTable> table = isolate->factory()->string_table();
17951 // We need a key instance for the virtual hash function. 17951 // We need a key instance for the virtual hash function.
17952 InternalizedStringKey dummy_key(isolate->factory()->empty_string()); 17952 InternalizedStringKey dummy_key(isolate->factory()->empty_string());
17953 table = StringTable::EnsureCapacity(table, expected, &dummy_key); 17953 table = StringTable::EnsureCapacity(table, expected, &dummy_key);
17954 isolate->heap()->SetRootStringTable(*table); 17954 isolate->heap()->SetRootStringTable(*table);
17955 } 17955 }
17956 17956
17957 17957
17958 Handle<String> StringTable::LookupString(Isolate* isolate, 17958 Handle<String> StringTable::LookupString(Isolate* isolate,
17959 Handle<String> string) { 17959 Handle<String> string) {
17960 if (string->IsConsString() && string->IsFlat()) {
17961 string = String::Flatten(string);
17962 if (string->IsInternalizedString()) return string;
17963 }
17964
17960 InternalizedStringKey key(string); 17965 InternalizedStringKey key(string);
17961 return LookupKey(isolate, &key); 17966 Handle<String> result = LookupKey(isolate, &key);
17967
17968 if (string->IsConsString()) {
17969 Handle<ConsString> cons = Handle<ConsString>::cast(string);
17970 cons->set_first(*result);
17971 cons->set_second(isolate->heap()->empty_string());
17972 }
17973 return result;
17962 } 17974 }
17963 17975
17964 17976
17965 Handle<String> StringTable::LookupKey(Isolate* isolate, HashTableKey* key) { 17977 Handle<String> StringTable::LookupKey(Isolate* isolate, HashTableKey* key) {
17966 Handle<StringTable> table = isolate->factory()->string_table(); 17978 Handle<StringTable> table = isolate->factory()->string_table();
17967 int entry = table->FindEntry(key); 17979 int entry = table->FindEntry(key);
17968 17980
17969 // String already in table. 17981 // String already in table.
17970 if (entry != kNotFound) { 17982 if (entry != kNotFound) {
17971 return handle(String::cast(table->KeyAt(entry)), isolate); 17983 return handle(String::cast(table->KeyAt(entry)), isolate);
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after
19828 if (cell->value() != *new_value) { 19840 if (cell->value() != *new_value) {
19829 cell->set_value(*new_value); 19841 cell->set_value(*new_value);
19830 Isolate* isolate = cell->GetIsolate(); 19842 Isolate* isolate = cell->GetIsolate();
19831 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19843 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19832 isolate, DependentCode::kPropertyCellChangedGroup); 19844 isolate, DependentCode::kPropertyCellChangedGroup);
19833 } 19845 }
19834 } 19846 }
19835 19847
19836 } // namespace internal 19848 } // namespace internal
19837 } // namespace v8 19849 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698