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.cc

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: [rename] Rename internal field to embedder field. Created 3 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 | « src/snapshot/snapshot-common.cc ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »
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 #include "src/value-serializer.h" 5 #include "src/value-serializer.h"
6 6
7 #include <type_traits> 7 #include <type_traits>
8 8
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 case JS_ARRAY_TYPE: 434 case JS_ARRAY_TYPE:
435 return WriteJSArray(Handle<JSArray>::cast(receiver)); 435 return WriteJSArray(Handle<JSArray>::cast(receiver));
436 case JS_OBJECT_TYPE: 436 case JS_OBJECT_TYPE:
437 case JS_API_OBJECT_TYPE: { 437 case JS_API_OBJECT_TYPE: {
438 Handle<JSObject> js_object = Handle<JSObject>::cast(receiver); 438 Handle<JSObject> js_object = Handle<JSObject>::cast(receiver);
439 Map* map = js_object->map(); 439 Map* map = js_object->map();
440 if (!FLAG_wasm_disable_structured_cloning && 440 if (!FLAG_wasm_disable_structured_cloning &&
441 map->GetConstructor() == 441 map->GetConstructor() ==
442 isolate_->native_context()->wasm_module_constructor()) { 442 isolate_->native_context()->wasm_module_constructor()) {
443 return WriteWasmModule(js_object); 443 return WriteWasmModule(js_object);
444 } else if (JSObject::GetInternalFieldCount(map)) { 444 } else if (JSObject::GetEmbedderFieldCount(map)) {
445 return WriteHostObject(js_object); 445 return WriteHostObject(js_object);
446 } else { 446 } else {
447 return WriteJSObject(js_object); 447 return WriteJSObject(js_object);
448 } 448 }
449 } 449 }
450 case JS_SPECIAL_API_OBJECT_TYPE: 450 case JS_SPECIAL_API_OBJECT_TYPE:
451 return WriteHostObject(Handle<JSObject>::cast(receiver)); 451 return WriteHostObject(Handle<JSObject>::cast(receiver));
452 case JS_DATE_TYPE: 452 case JS_DATE_TYPE:
453 WriteJSDate(JSDate::cast(*receiver)); 453 WriteJSDate(JSDate::cast(*receiver));
454 return ThrowIfOutOfMemory(); 454 return ThrowIfOutOfMemory();
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 tag = ArrayBufferViewTag::kDataView; 797 tag = ArrayBufferViewTag::kDataView;
798 } 798 }
799 WriteVarint(static_cast<uint8_t>(tag)); 799 WriteVarint(static_cast<uint8_t>(tag));
800 WriteVarint(NumberToUint32(view->byte_offset())); 800 WriteVarint(NumberToUint32(view->byte_offset()));
801 WriteVarint(NumberToUint32(view->byte_length())); 801 WriteVarint(NumberToUint32(view->byte_length()));
802 return ThrowIfOutOfMemory(); 802 return ThrowIfOutOfMemory();
803 } 803 }
804 804
805 Maybe<bool> ValueSerializer::WriteWasmModule(Handle<JSObject> object) { 805 Maybe<bool> ValueSerializer::WriteWasmModule(Handle<JSObject> object) {
806 Handle<WasmCompiledModule> compiled_part( 806 Handle<WasmCompiledModule> compiled_part(
807 WasmCompiledModule::cast(object->GetInternalField(0)), isolate_); 807 WasmCompiledModule::cast(object->GetEmbedderField(0)), isolate_);
808 WasmEncodingTag encoding_tag = WasmEncodingTag::kRawBytes; 808 WasmEncodingTag encoding_tag = WasmEncodingTag::kRawBytes;
809 WriteTag(SerializationTag::kWasmModule); 809 WriteTag(SerializationTag::kWasmModule);
810 WriteRawBytes(&encoding_tag, sizeof(encoding_tag)); 810 WriteRawBytes(&encoding_tag, sizeof(encoding_tag));
811 811
812 Handle<String> wire_bytes(compiled_part->module_bytes(), isolate_); 812 Handle<String> wire_bytes(compiled_part->module_bytes(), isolate_);
813 int wire_bytes_length = wire_bytes->length(); 813 int wire_bytes_length = wire_bytes->length();
814 WriteVarint<uint32_t>(wire_bytes_length); 814 WriteVarint<uint32_t>(wire_bytes_length);
815 uint8_t* destination; 815 uint8_t* destination;
816 if (ReserveRawBytes(wire_bytes_length).To(&destination)) { 816 if (ReserveRawBytes(wire_bytes_length).To(&destination)) {
817 String::WriteToFlat(*wire_bytes, destination, 0, wire_bytes_length); 817 String::WriteToFlat(*wire_bytes, destination, 0, wire_bytes_length);
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 if (stack.size() != 1) { 1969 if (stack.size() != 1) {
1970 isolate_->Throw(*isolate_->factory()->NewError( 1970 isolate_->Throw(*isolate_->factory()->NewError(
1971 MessageTemplate::kDataCloneDeserializationError)); 1971 MessageTemplate::kDataCloneDeserializationError));
1972 return MaybeHandle<Object>(); 1972 return MaybeHandle<Object>();
1973 } 1973 }
1974 return scope.CloseAndEscape(stack[0]); 1974 return scope.CloseAndEscape(stack[0]);
1975 } 1975 }
1976 1976
1977 } // namespace internal 1977 } // namespace internal
1978 } // namespace v8 1978 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/snapshot-common.cc ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698