OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1929 | 1929 |
1930 Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer, | 1930 Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer, |
1931 size_t byte_offset, | 1931 size_t byte_offset, |
1932 size_t byte_length) { | 1932 size_t byte_length) { |
1933 Handle<JSDataView> obj = NewJSDataView(); | 1933 Handle<JSDataView> obj = NewJSDataView(); |
1934 SetupArrayBufferView(isolate(), obj, buffer, byte_offset, byte_length); | 1934 SetupArrayBufferView(isolate(), obj, buffer, byte_offset, byte_length); |
1935 return obj; | 1935 return obj; |
1936 } | 1936 } |
1937 | 1937 |
1938 | 1938 |
1939 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, | 1939 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> target, |
1940 Handle<Object> prototype) { | 1940 Handle<Object> handler) { |
1941 // Allocate map. | 1941 // Allocate map. |
1942 // TODO(rossberg): Once we optimize proxies, think about a scheme to share | 1942 // TODO(rossberg): Once we optimize proxies, think about a scheme to share |
1943 // maps. Will probably depend on the identity of the handler object, too. | 1943 // maps. Will probably depend on the identity of the handler object, too. |
1944 Handle<Map> map = NewMap(JS_PROXY_TYPE, JSProxy::kSize); | 1944 Handle<Map> map = NewMap(JS_PROXY_TYPE, JSProxy::kSize); |
1945 Map::SetPrototype(map, prototype); | 1945 Map::SetPrototype(map, target); |
rossberg
2015/11/12 17:04:39
Not sure that makes sense. For the new proxy seman
Camillo Bruni
2015/11/12 20:20:55
same as above, will go away.
| |
1946 | 1946 |
1947 // Allocate the proxy object. | 1947 // Allocate the proxy object. |
1948 Handle<JSProxy> result = New<JSProxy>(map, NEW_SPACE); | 1948 Handle<JSProxy> result = New<JSProxy>(map, NEW_SPACE); |
1949 result->InitializeBody(map->instance_size(), Smi::FromInt(0)); | 1949 result->InitializeBody(map->instance_size(), Smi::FromInt(0)); |
1950 result->set_handler(*handler); | 1950 result->set_handler(*handler); |
1951 result->set_hash(*undefined_value(), SKIP_WRITE_BARRIER); | 1951 result->set_hash(*undefined_value(), SKIP_WRITE_BARRIER); |
1952 return result; | 1952 return result; |
1953 } | 1953 } |
1954 | 1954 |
1955 | 1955 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2403 } | 2403 } |
2404 | 2404 |
2405 | 2405 |
2406 Handle<Object> Factory::ToBoolean(bool value) { | 2406 Handle<Object> Factory::ToBoolean(bool value) { |
2407 return value ? true_value() : false_value(); | 2407 return value ? true_value() : false_value(); |
2408 } | 2408 } |
2409 | 2409 |
2410 | 2410 |
2411 } // namespace internal | 2411 } // namespace internal |
2412 } // namespace v8 | 2412 } // namespace v8 |
OLD | NEW |