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

Side by Side Diff: lib/isolate.cc

Issue 11613009: Changed the API in DartEntry for invoking dart code from C++ to make it more compatible with the re… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart.h" 8 #include "vm/dart.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); 55 Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
56 ASSERT(!isolate_lib.IsNull()); 56 ASSERT(!isolate_lib.IsNull());
57 const String& public_class_name = 57 const String& public_class_name =
58 String::Handle(Symbols::New("_ReceivePortImpl")); 58 String::Handle(Symbols::New("_ReceivePortImpl"));
59 const String& class_name = 59 const String& class_name =
60 String::Handle(isolate_lib.PrivateName(public_class_name)); 60 String::Handle(isolate_lib.PrivateName(public_class_name));
61 const String& function_name = 61 const String& function_name =
62 String::Handle(Symbols::New("_get_or_create")); 62 String::Handle(Symbols::New("_get_or_create"));
63 const int kNumArguments = 1; 63 const int kNumArguments = 1;
64 const Array& kNoArgumentNames = Array::Handle(); 64 const Array& kNoArgumentNames = Array::Handle();
65 const Function& function = Function::Handle( 65 const Function& func = Function::Handle(
66 Resolver::ResolveStatic(isolate_lib, 66 Resolver::ResolveStatic(isolate_lib,
67 class_name, 67 class_name,
68 function_name, 68 function_name,
69 kNumArguments, 69 kNumArguments,
70 kNoArgumentNames, 70 kNoArgumentNames,
71 Resolver::kIsQualified)); 71 Resolver::kIsQualified));
72 GrowableArray<const Object*> arguments(kNumArguments); 72 const Array& args = Array::Handle(Array::New(kNumArguments));
73 arguments.Add(&Integer::Handle(Integer::New(port_id))); 73 args.SetAt(0, Integer::Handle(Integer::New(port_id)));
74 const Object& result = Object::Handle( 74 const Object& result = Object::Handle(DartEntry::InvokeStatic(func, args));
75 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
76 if (!result.IsError()) { 75 if (!result.IsError()) {
77 PortMap::SetLive(port_id); 76 PortMap::SetLive(port_id);
78 } 77 }
79 return result.raw(); 78 return result.raw();
80 } 79 }
81 80
82 81
83 static void ShutdownIsolate(uword parameter) { 82 static void ShutdownIsolate(uword parameter) {
84 Isolate* isolate = reinterpret_cast<Isolate*>(parameter); 83 Isolate* isolate = reinterpret_cast<Isolate*>(parameter);
85 { 84 {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 result = state->ResolveFunction(); 366 result = state->ResolveFunction();
368 delete state; 367 delete state;
369 state = NULL; 368 state = NULL;
370 if (result.IsError()) { 369 if (result.IsError()) {
371 StoreError(isolate, result); 370 StoreError(isolate, result);
372 return false; 371 return false;
373 } 372 }
374 ASSERT(result.IsFunction()); 373 ASSERT(result.IsFunction());
375 Function& func = Function::Handle(isolate); 374 Function& func = Function::Handle(isolate);
376 func ^= result.raw(); 375 func ^= result.raw();
377 GrowableArray<const Object*> args(0); 376 const Array& args = Array::Handle(Object::empty_array());
378 const Array& kNoArgNames = Array::Handle(); 377 result = DartEntry::InvokeStatic(func, args);
379 result = DartEntry::InvokeStatic(func, args, kNoArgNames);
380 if (result.IsError()) { 378 if (result.IsError()) {
381 StoreError(isolate, result); 379 StoreError(isolate, result);
382 return false; 380 return false;
383 } 381 }
384 } 382 }
385 return true; 383 return true;
386 } 384 }
387 385
388 386
389 static RawObject* Spawn(NativeArguments* arguments, SpawnState* state) { 387 static RawObject* Spawn(NativeArguments* arguments, SpawnState* state) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 487
490 DEFINE_NATIVE_ENTRY(isolate_getPortInternal, 0) { 488 DEFINE_NATIVE_ENTRY(isolate_getPortInternal, 0) {
491 const Object& port = Object::Handle(ReceivePortCreate(isolate->main_port())); 489 const Object& port = Object::Handle(ReceivePortCreate(isolate->main_port()));
492 if (port.IsError()) { 490 if (port.IsError()) {
493 Exceptions::PropagateError(Error::Cast(port)); 491 Exceptions::PropagateError(Error::Cast(port));
494 } 492 }
495 return port.raw(); 493 return port.raw();
496 } 494 }
497 495
498 } // namespace dart 496 } // namespace dart
OLDNEW
« no previous file with comments | « lib/invocation_mirror.cc ('k') | tests/vm/vm.status » ('j') | vm/dart_entry.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698