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

Side by Side Diff: src/value-serializer.h

Issue 2304563004: Take advantage of fast properties in ValueSerializer when JSObject has them. (Closed)
Patch Set: cbruni comments Created 4 years, 3 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 | src/value-serializer.cc » ('j') | src/value-serializer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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_VALUE_SERIALIZER_H_ 5 #ifndef V8_VALUE_SERIALIZER_H_
6 #define V8_VALUE_SERIALIZER_H_ 6 #define V8_VALUE_SERIALIZER_H_
7 7
8 #include <cstdint> 8 #include <cstdint>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void WriteRawBytes(const void* source, size_t length); 81 void WriteRawBytes(const void* source, size_t length);
82 uint8_t* ReserveRawBytes(size_t bytes); 82 uint8_t* ReserveRawBytes(size_t bytes);
83 83
84 // Writing V8 objects of various kinds. 84 // Writing V8 objects of various kinds.
85 void WriteOddball(Oddball* oddball); 85 void WriteOddball(Oddball* oddball);
86 void WriteSmi(Smi* smi); 86 void WriteSmi(Smi* smi);
87 void WriteHeapNumber(HeapNumber* number); 87 void WriteHeapNumber(HeapNumber* number);
88 void WriteString(Handle<String> string); 88 void WriteString(Handle<String> string);
89 Maybe<bool> WriteJSReceiver(Handle<JSReceiver> receiver) WARN_UNUSED_RESULT; 89 Maybe<bool> WriteJSReceiver(Handle<JSReceiver> receiver) WARN_UNUSED_RESULT;
90 Maybe<bool> WriteJSObject(Handle<JSObject> object) WARN_UNUSED_RESULT; 90 Maybe<bool> WriteJSObject(Handle<JSObject> object) WARN_UNUSED_RESULT;
91 Maybe<bool> WriteJSObjectSlow(Handle<JSObject> object) WARN_UNUSED_RESULT;
91 Maybe<bool> WriteJSArray(Handle<JSArray> array) WARN_UNUSED_RESULT; 92 Maybe<bool> WriteJSArray(Handle<JSArray> array) WARN_UNUSED_RESULT;
92 void WriteJSDate(JSDate* date); 93 void WriteJSDate(JSDate* date);
93 Maybe<bool> WriteJSValue(Handle<JSValue> value) WARN_UNUSED_RESULT; 94 Maybe<bool> WriteJSValue(Handle<JSValue> value) WARN_UNUSED_RESULT;
94 void WriteJSRegExp(JSRegExp* regexp); 95 void WriteJSRegExp(JSRegExp* regexp);
95 Maybe<bool> WriteJSMap(Handle<JSMap> map) WARN_UNUSED_RESULT; 96 Maybe<bool> WriteJSMap(Handle<JSMap> map) WARN_UNUSED_RESULT;
96 Maybe<bool> WriteJSSet(Handle<JSSet> map) WARN_UNUSED_RESULT; 97 Maybe<bool> WriteJSSet(Handle<JSSet> map) WARN_UNUSED_RESULT;
97 Maybe<bool> WriteJSArrayBuffer(JSArrayBuffer* array_buffer); 98 Maybe<bool> WriteJSArrayBuffer(JSArrayBuffer* array_buffer);
98 Maybe<bool> WriteJSArrayBufferView(JSArrayBufferView* array_buffer); 99 Maybe<bool> WriteJSArrayBufferView(JSArrayBufferView* array_buffer);
99 100
100 /* 101 /*
101 * Reads the specified keys from the object and writes key-value pairs to the 102 * Reads the specified keys from the object and writes key-value pairs to the
102 * buffer. Returns the number of keys actually written, which may be smaller 103 * buffer. Returns the number of keys actually written, which may be smaller
103 * if some keys are not own properties when accessed. 104 * if some keys are not own properties when accessed.
104 */ 105 */
105 Maybe<uint32_t> WriteJSObjectProperties( 106 Maybe<uint32_t> WriteJSObjectPropertiesSlow(
106 Handle<JSObject> object, Handle<FixedArray> keys) WARN_UNUSED_RESULT; 107 Handle<JSObject> object, Handle<FixedArray> keys) WARN_UNUSED_RESULT;
107 108
108 Isolate* const isolate_; 109 Isolate* const isolate_;
109 std::vector<uint8_t> buffer_; 110 std::vector<uint8_t> buffer_;
110 Zone zone_; 111 Zone zone_;
111 112
112 // To avoid extra lookups in the identity map, ID+1 is actually stored in the 113 // To avoid extra lookups in the identity map, ID+1 is actually stored in the
113 // map (checking if the used identity is zero is the fast way of checking if 114 // map (checking if the used identity is zero is the fast way of checking if
114 // the entry is new). 115 // the entry is new).
115 IdentityMap<uint32_t> id_map_; 116 IdentityMap<uint32_t> id_map_;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 Handle<SeededNumberDictionary> id_map_; 221 Handle<SeededNumberDictionary> id_map_;
221 MaybeHandle<SeededNumberDictionary> array_buffer_transfer_map_; 222 MaybeHandle<SeededNumberDictionary> array_buffer_transfer_map_;
222 223
223 DISALLOW_COPY_AND_ASSIGN(ValueDeserializer); 224 DISALLOW_COPY_AND_ASSIGN(ValueDeserializer);
224 }; 225 };
225 226
226 } // namespace internal 227 } // namespace internal
227 } // namespace v8 228 } // namespace v8
228 229
229 #endif // V8_VALUE_SERIALIZER_H_ 230 #endif // V8_VALUE_SERIALIZER_H_
OLDNEW
« no previous file with comments | « no previous file | src/value-serializer.cc » ('j') | src/value-serializer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698