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 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<JSReceiver> target, | 1939 Handle<JSProxy> Factory::NewJSProxy(Handle<JSReceiver> target, |
1940 Handle<JSReceiver> handler, | 1940 Handle<JSReceiver> handler) { |
1941 Handle<Object> prototype) { | |
1942 // Allocate map. | 1941 // Allocate map. |
1943 // 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 |
1944 // 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. |
1945 Handle<Map> map = NewMap(JS_PROXY_TYPE, JSProxy::kSize); | 1944 Handle<Map> map = NewMap(JS_PROXY_TYPE, JSProxy::kSize); |
1946 Map::SetPrototype(map, prototype); | 1945 Map::SetPrototype(map, null_value()); |
1947 | 1946 |
1948 // Allocate the proxy object. | 1947 // Allocate the proxy object. |
1949 Handle<JSProxy> result = New<JSProxy>(map, NEW_SPACE); | 1948 Handle<JSProxy> result = New<JSProxy>(map, NEW_SPACE); |
1950 result->set_target(*target); | 1949 result->set_target(*target); |
1951 result->set_handler(*handler); | 1950 result->set_handler(*handler); |
1952 result->set_hash(*undefined_value(), SKIP_WRITE_BARRIER); | 1951 result->set_hash(*undefined_value(), SKIP_WRITE_BARRIER); |
1953 return result; | 1952 return result; |
1954 } | 1953 } |
1955 | 1954 |
1956 | 1955 |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 } | 2334 } |
2336 | 2335 |
2337 | 2336 |
2338 Handle<Object> Factory::ToBoolean(bool value) { | 2337 Handle<Object> Factory::ToBoolean(bool value) { |
2339 return value ? true_value() : false_value(); | 2338 return value ? true_value() : false_value(); |
2340 } | 2339 } |
2341 | 2340 |
2342 | 2341 |
2343 } // namespace internal | 2342 } // namespace internal |
2344 } // namespace v8 | 2343 } // namespace v8 |
OLD | NEW |