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