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/api-natives.h" | 5 #include "src/api-natives.h" |
6 #include "src/api.h" | 6 #include "src/api.h" |
7 #include "src/asmjs/asm-js.h" | 7 #include "src/asmjs/asm-js.h" |
8 #include "src/asmjs/asm-typer.h" | 8 #include "src/asmjs/asm-typer.h" |
9 #include "src/asmjs/asm-wasm-builder.h" | 9 #include "src/asmjs/asm-wasm-builder.h" |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
730 &in_object_properties); | 730 &in_object_properties); |
731 | 731 |
732 int unused_property_fields = in_object_properties - pre_allocated; | 732 int unused_property_fields = in_object_properties - pre_allocated; |
733 Handle<Map> map = Map::CopyInitialMap( | 733 Handle<Map> map = Map::CopyInitialMap( |
734 prev_map, instance_size, in_object_properties, unused_property_fields); | 734 prev_map, instance_size, in_object_properties, unused_property_fields); |
735 | 735 |
736 context->set_wasm_function_map(*map); | 736 context->set_wasm_function_map(*map); |
737 } | 737 } |
738 } | 738 } |
739 | 739 |
740 bool WasmJs::IsWasmMemoryObject(Isolate* isolate, Handle<Object> value) { | |
741 if (value->IsJSObject()) { | |
742 i::Handle<i::JSObject> object = i::Handle<i::JSObject>::cast(value); | |
743 i::Handle<i::Symbol> sym(isolate->context()->wasm_memory_sym(), isolate); | |
744 Maybe<bool> has_brand = i::JSObject::HasOwnProperty(object, sym); | |
ahaas
2016/10/07 08:23:36
Can sym also be further up the prototype chain? If
titzer
2016/10/07 08:50:52
Definitely don't want to go up the prototype chain
| |
745 if (has_brand.IsNothing()) return false; | |
746 if (has_brand.ToChecked()) return true; | |
747 } | |
748 return false; | |
749 } | |
750 | |
751 Handle<JSArrayBuffer> WasmJs::GetWasmMemoryArrayBuffer(Isolate* isolate, | |
752 Handle<Object> value) { | |
753 DCHECK(IsWasmMemoryObject(isolate, value)); | |
754 Handle<Object> buf(JSObject::cast(*value)->GetInternalField(0), isolate); | |
ahaas
2016/10/07 08:23:36
Could we use a constant for index 0?
titzer
2016/10/07 08:50:52
Done.
| |
755 return Handle<JSArrayBuffer>::cast(buf); | |
756 } | |
740 } // namespace internal | 757 } // namespace internal |
741 } // namespace v8 | 758 } // namespace v8 |
OLD | NEW |