| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "v8.h" | 8 #include "v8.h" |
| 9 | 9 |
| 10 #include "accessors.h" | 10 #include "accessors.h" |
| (...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 if (NeedToFlipBytes(is_little_endian)) { | 1397 if (NeedToFlipBytes(is_little_endian)) { |
| 1398 FlipBytes<sizeof(T)>(target, value.bytes); | 1398 FlipBytes<sizeof(T)>(target, value.bytes); |
| 1399 } else { | 1399 } else { |
| 1400 CopyBytes<sizeof(T)>(target, value.bytes); | 1400 CopyBytes<sizeof(T)>(target, value.bytes); |
| 1401 } | 1401 } |
| 1402 return true; | 1402 return true; |
| 1403 } | 1403 } |
| 1404 | 1404 |
| 1405 | 1405 |
| 1406 #define DATA_VIEW_GETTER(TypeName, Type, Converter) \ | 1406 #define DATA_VIEW_GETTER(TypeName, Type, Converter) \ |
| 1407 RUNTIME_FUNCTION(Runtime_DataViewGet##TypeName) { \ | 1407 RUNTIME_FUNCTION(Runtime_DataViewGet##TypeName) { \ |
| 1408 HandleScope scope(isolate); \ | 1408 HandleScope scope(isolate); \ |
| 1409 ASSERT(args.length() == 3); \ | 1409 ASSERT(args.length() == 3); \ |
| 1410 CONVERT_ARG_HANDLE_CHECKED(JSDataView, holder, 0); \ | 1410 CONVERT_ARG_HANDLE_CHECKED(JSDataView, holder, 0); \ |
| 1411 CONVERT_ARG_HANDLE_CHECKED(Object, offset, 1); \ | 1411 CONVERT_NUMBER_ARG_HANDLE_CHECKED(offset, 1); \ |
| 1412 CONVERT_BOOLEAN_ARG_CHECKED(is_little_endian, 2); \ | 1412 CONVERT_BOOLEAN_ARG_CHECKED(is_little_endian, 2); \ |
| 1413 Type result; \ | 1413 Type result; \ |
| 1414 if (DataViewGetValue( \ | 1414 if (DataViewGetValue( \ |
| 1415 isolate, holder, offset, is_little_endian, &result)) { \ | 1415 isolate, holder, offset, is_little_endian, &result)) { \ |
| 1416 return *isolate->factory()->Converter(result); \ | 1416 return *isolate->factory()->Converter(result); \ |
| 1417 } else { \ | 1417 } else { \ |
| 1418 return isolate->Throw(*isolate->factory()->NewRangeError( \ | 1418 return isolate->Throw(*isolate->factory()->NewRangeError( \ |
| 1419 "invalid_data_view_accessor_offset", \ | 1419 "invalid_data_view_accessor_offset", \ |
| 1420 HandleVector<Object>(NULL, 0))); \ | 1420 HandleVector<Object>(NULL, 0))); \ |
| 1421 } \ | 1421 } \ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 | 1481 |
| 1482 template <> | 1482 template <> |
| 1483 double DataViewConvertValue<double>(double value) { | 1483 double DataViewConvertValue<double>(double value) { |
| 1484 return value; | 1484 return value; |
| 1485 } | 1485 } |
| 1486 | 1486 |
| 1487 | 1487 |
| 1488 #define DATA_VIEW_SETTER(TypeName, Type) \ | 1488 #define DATA_VIEW_SETTER(TypeName, Type) \ |
| 1489 RUNTIME_FUNCTION(Runtime_DataViewSet##TypeName) { \ | 1489 RUNTIME_FUNCTION(Runtime_DataViewSet##TypeName) { \ |
| 1490 HandleScope scope(isolate); \ | 1490 HandleScope scope(isolate); \ |
| 1491 ASSERT(args.length() == 4); \ | 1491 ASSERT(args.length() == 4); \ |
| 1492 CONVERT_ARG_HANDLE_CHECKED(JSDataView, holder, 0); \ | 1492 CONVERT_ARG_HANDLE_CHECKED(JSDataView, holder, 0); \ |
| 1493 CONVERT_ARG_HANDLE_CHECKED(Object, offset, 1); \ | 1493 CONVERT_NUMBER_ARG_HANDLE_CHECKED(offset, 1); \ |
| 1494 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); \ | 1494 CONVERT_NUMBER_ARG_HANDLE_CHECKED(value, 2); \ |
| 1495 CONVERT_BOOLEAN_ARG_CHECKED(is_little_endian, 3); \ | 1495 CONVERT_BOOLEAN_ARG_CHECKED(is_little_endian, 3); \ |
| 1496 Type v = DataViewConvertValue<Type>(value->Number()); \ | 1496 Type v = DataViewConvertValue<Type>(value->Number()); \ |
| 1497 if (DataViewSetValue( \ | 1497 if (DataViewSetValue( \ |
| 1498 isolate, holder, offset, is_little_endian, v)) { \ | 1498 isolate, holder, offset, is_little_endian, v)) { \ |
| 1499 return isolate->heap()->undefined_value(); \ | 1499 return isolate->heap()->undefined_value(); \ |
| 1500 } else { \ | 1500 } else { \ |
| 1501 return isolate->Throw(*isolate->factory()->NewRangeError( \ | 1501 return isolate->Throw(*isolate->factory()->NewRangeError( \ |
| 1502 "invalid_data_view_accessor_offset", \ | 1502 "invalid_data_view_accessor_offset", \ |
| 1503 HandleVector<Object>(NULL, 0))); \ | 1503 HandleVector<Object>(NULL, 0))); \ |
| 1504 } \ | 1504 } \ |
| (...skipping 13723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15228 } | 15228 } |
| 15229 return NULL; | 15229 return NULL; |
| 15230 } | 15230 } |
| 15231 | 15231 |
| 15232 | 15232 |
| 15233 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15233 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15234 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15234 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15235 } | 15235 } |
| 15236 | 15236 |
| 15237 } } // namespace v8::internal | 15237 } } // namespace v8::internal |
| OLD | NEW |