OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() { | 1049 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() { |
1050 JSFunction* array_buffer_fun = | 1050 JSFunction* array_buffer_fun = |
1051 isolate()->context()->native_context()->array_buffer_fun(); | 1051 isolate()->context()->native_context()->array_buffer_fun(); |
1052 CALL_HEAP_FUNCTION( | 1052 CALL_HEAP_FUNCTION( |
1053 isolate(), | 1053 isolate(), |
1054 isolate()->heap()->AllocateJSObject(array_buffer_fun), | 1054 isolate()->heap()->AllocateJSObject(array_buffer_fun), |
1055 JSArrayBuffer); | 1055 JSArrayBuffer); |
1056 } | 1056 } |
1057 | 1057 |
1058 | 1058 |
| 1059 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) { |
| 1060 JSFunction* typed_array_fun; |
| 1061 Context* native_context = isolate()->context()->native_context(); |
| 1062 switch (type) { |
| 1063 case kExternalUnsignedByteArray: |
| 1064 typed_array_fun = native_context->uint8_array_fun(); |
| 1065 break; |
| 1066 |
| 1067 case kExternalByteArray: |
| 1068 typed_array_fun = native_context->int8_array_fun(); |
| 1069 break; |
| 1070 |
| 1071 case kExternalUnsignedShortArray: |
| 1072 typed_array_fun = native_context->uint16_array_fun(); |
| 1073 break; |
| 1074 |
| 1075 case kExternalShortArray: |
| 1076 typed_array_fun = native_context->int16_array_fun(); |
| 1077 break; |
| 1078 |
| 1079 case kExternalUnsignedIntArray: |
| 1080 typed_array_fun = native_context->uint32_array_fun(); |
| 1081 break; |
| 1082 |
| 1083 case kExternalIntArray: |
| 1084 typed_array_fun = native_context->int32_array_fun(); |
| 1085 break; |
| 1086 |
| 1087 case kExternalFloatArray: |
| 1088 typed_array_fun = native_context->float_array_fun(); |
| 1089 break; |
| 1090 |
| 1091 case kExternalDoubleArray: |
| 1092 typed_array_fun = native_context->double_array_fun(); |
| 1093 break; |
| 1094 |
| 1095 default: |
| 1096 UNREACHABLE(); |
| 1097 return Handle<JSTypedArray>(); |
| 1098 } |
| 1099 |
| 1100 CALL_HEAP_FUNCTION( |
| 1101 isolate(), |
| 1102 isolate()->heap()->AllocateJSObject(typed_array_fun), |
| 1103 JSTypedArray); |
| 1104 } |
| 1105 |
| 1106 |
1059 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, | 1107 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, |
1060 Handle<Object> prototype) { | 1108 Handle<Object> prototype) { |
1061 CALL_HEAP_FUNCTION( | 1109 CALL_HEAP_FUNCTION( |
1062 isolate(), | 1110 isolate(), |
1063 isolate()->heap()->AllocateJSProxy(*handler, *prototype), | 1111 isolate()->heap()->AllocateJSProxy(*handler, *prototype), |
1064 JSProxy); | 1112 JSProxy); |
1065 } | 1113 } |
1066 | 1114 |
1067 | 1115 |
1068 void Factory::BecomeJSObject(Handle<JSReceiver> object) { | 1116 void Factory::BecomeJSObject(Handle<JSReceiver> object) { |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 return Handle<Object>::null(); | 1544 return Handle<Object>::null(); |
1497 } | 1545 } |
1498 | 1546 |
1499 | 1547 |
1500 Handle<Object> Factory::ToBoolean(bool value) { | 1548 Handle<Object> Factory::ToBoolean(bool value) { |
1501 return value ? true_value() : false_value(); | 1549 return value ? true_value() : false_value(); |
1502 } | 1550 } |
1503 | 1551 |
1504 | 1552 |
1505 } } // namespace v8::internal | 1553 } } // namespace v8::internal |
OLD | NEW |