| OLD | NEW |
| 1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include "src/vm/natives.h" | 5 #include "src/vm/natives.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <math.h> | 8 #include <math.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 ASSERT(byte_index + 4 <= backing->length()); | 1307 ASSERT(byte_index + 4 <= backing->length()); |
| 1308 uint8* byte_address = backing->byte_address_for(byte_index); | 1308 uint8* byte_address = backing->byte_address_for(byte_index); |
| 1309 Object* object = arguments[2]; | 1309 Object* object = arguments[2]; |
| 1310 uint32 value = object->IsSmi() | 1310 uint32 value = object->IsSmi() |
| 1311 ? Smi::cast(object)->value() | 1311 ? Smi::cast(object)->value() |
| 1312 : LargeInteger::cast(object)->value(); | 1312 : LargeInteger::cast(object)->value(); |
| 1313 *reinterpret_cast<uint32*>(byte_address) = value; | 1313 *reinterpret_cast<uint32*>(byte_address) = value; |
| 1314 return process->program()->null_object(); | 1314 return process->program()->null_object(); |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 NATIVE(TimerScheduleTimeout) { |
| 1318 int64 timeout = AsForeignInt64(arguments[0]); |
| 1319 Instance* instance = Instance::cast(arguments[1]); |
| 1320 ASSERT(instance->IsPort()); |
| 1321 Object* field = instance->GetInstanceField(0); |
| 1322 uword address = AsForeignWord(field); |
| 1323 Port* port = reinterpret_cast<Port*>(address); |
| 1324 process->program()->event_handler()->ScheduleTimeout(timeout, port); |
| 1325 return process->program()->null_object(); |
| 1326 } |
| 1327 |
| 1317 } // namespace fletch | 1328 } // namespace fletch |
| OLD | NEW |