| 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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 Handle<HeapNumber> Factory::NewHeapNumber(double value, | 1049 Handle<HeapNumber> Factory::NewHeapNumber(double value, |
| 1050 MutableMode mode, | 1050 MutableMode mode, |
| 1051 PretenureFlag pretenure) { | 1051 PretenureFlag pretenure) { |
| 1052 CALL_HEAP_FUNCTION( | 1052 CALL_HEAP_FUNCTION( |
| 1053 isolate(), | 1053 isolate(), |
| 1054 isolate()->heap()->AllocateHeapNumber(value, mode, pretenure), | 1054 isolate()->heap()->AllocateHeapNumber(value, mode, pretenure), |
| 1055 HeapNumber); | 1055 HeapNumber); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 | 1058 |
| 1059 Handle<Float32x4> Factory::NewFloat32x4(float lanes[4], | 1059 #define SIMD128_NEW_DEF(TYPE, Type, type, lane_count, lane_type) \ |
| 1060 PretenureFlag pretenure) { | 1060 Handle<Type> Factory::New##Type(lane_type lanes[lane_count], \ |
| 1061 CALL_HEAP_FUNCTION(isolate(), | 1061 PretenureFlag pretenure) { \ |
| 1062 isolate()->heap()->AllocateFloat32x4(lanes, pretenure), | 1062 CALL_HEAP_FUNCTION( \ |
| 1063 Float32x4); | 1063 isolate(), isolate()->heap()->Allocate##Type(lanes, pretenure), Type); \ |
| 1064 } | 1064 } |
| 1065 | 1065 SIMD128_TYPES(SIMD128_NEW_DEF) |
| 1066 | 1066 #undef SIMD128_NEW_DEF |
| 1067 Handle<Int32x4> Factory::NewInt32x4(int32_t lanes[4], PretenureFlag pretenure) { | |
| 1068 CALL_HEAP_FUNCTION( | |
| 1069 isolate(), isolate()->heap()->AllocateInt32x4(lanes, pretenure), Int32x4); | |
| 1070 } | |
| 1071 | |
| 1072 | |
| 1073 Handle<Bool32x4> Factory::NewBool32x4(bool lanes[4], PretenureFlag pretenure) { | |
| 1074 CALL_HEAP_FUNCTION(isolate(), | |
| 1075 isolate()->heap()->AllocateBool32x4(lanes, pretenure), | |
| 1076 Bool32x4); | |
| 1077 } | |
| 1078 | |
| 1079 | |
| 1080 Handle<Int16x8> Factory::NewInt16x8(int16_t lanes[8], PretenureFlag pretenure) { | |
| 1081 CALL_HEAP_FUNCTION( | |
| 1082 isolate(), isolate()->heap()->AllocateInt16x8(lanes, pretenure), Int16x8); | |
| 1083 } | |
| 1084 | |
| 1085 | |
| 1086 Handle<Bool16x8> Factory::NewBool16x8(bool lanes[8], PretenureFlag pretenure) { | |
| 1087 CALL_HEAP_FUNCTION(isolate(), | |
| 1088 isolate()->heap()->AllocateBool16x8(lanes, pretenure), | |
| 1089 Bool16x8); | |
| 1090 } | |
| 1091 | |
| 1092 | |
| 1093 Handle<Int8x16> Factory::NewInt8x16(int8_t lanes[16], PretenureFlag pretenure) { | |
| 1094 CALL_HEAP_FUNCTION( | |
| 1095 isolate(), isolate()->heap()->AllocateInt8x16(lanes, pretenure), Int8x16); | |
| 1096 } | |
| 1097 | |
| 1098 | |
| 1099 Handle<Bool8x16> Factory::NewBool8x16(bool lanes[16], PretenureFlag pretenure) { | |
| 1100 CALL_HEAP_FUNCTION(isolate(), | |
| 1101 isolate()->heap()->AllocateBool8x16(lanes, pretenure), | |
| 1102 Bool8x16); | |
| 1103 } | |
| 1104 | 1067 |
| 1105 | 1068 |
| 1106 Handle<Object> Factory::NewError(Handle<JSFunction> constructor, | 1069 Handle<Object> Factory::NewError(Handle<JSFunction> constructor, |
| 1107 MessageTemplate::Template template_index, | 1070 MessageTemplate::Template template_index, |
| 1108 Handle<Object> arg0, Handle<Object> arg1, | 1071 Handle<Object> arg0, Handle<Object> arg1, |
| 1109 Handle<Object> arg2) { | 1072 Handle<Object> arg2) { |
| 1110 HandleScope scope(isolate()); | 1073 HandleScope scope(isolate()); |
| 1111 if (isolate()->bootstrapper()->IsActive()) { | 1074 if (isolate()->bootstrapper()->IsActive()) { |
| 1112 // During bootstrapping we cannot construct error objects. | 1075 // During bootstrapping we cannot construct error objects. |
| 1113 return scope.CloseAndEscape(NewStringFromAsciiChecked( | 1076 return scope.CloseAndEscape(NewStringFromAsciiChecked( |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2354 } | 2317 } |
| 2355 | 2318 |
| 2356 | 2319 |
| 2357 Handle<Object> Factory::ToBoolean(bool value) { | 2320 Handle<Object> Factory::ToBoolean(bool value) { |
| 2358 return value ? true_value() : false_value(); | 2321 return value ? true_value() : false_value(); |
| 2359 } | 2322 } |
| 2360 | 2323 |
| 2361 | 2324 |
| 2362 } // namespace internal | 2325 } // namespace internal |
| 2363 } // namespace v8 | 2326 } // namespace v8 |
| OLD | NEW |