Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: src/vm/natives.cc

Issue 1375373004: Use the event-handler for timers. (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/vm/heap.h ('k') | tests/debugger/async_expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/vm/heap.h ('k') | tests/debugger/async_expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698