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

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 117723002: Allow the native resolver to setup whether it needs the Dart API scope to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/debugger_api_impl_test.cc » ('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) 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 "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "include/dart_api.h" 6 #include "include/dart_api.h"
7 #include "include/dart_debugger_api.h" 7 #include "include/dart_debugger_api.h"
8 #include "include/dart_mirrors_api.h" 8 #include "include/dart_mirrors_api.h"
9 #include "include/dart_native_api.h" 9 #include "include/dart_native_api.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 EXPECT(Dart_IsError(result)); 363 EXPECT(Dart_IsError(result));
364 result = Dart_GetActivationFrame(stacktrace, -1, &frame); 364 result = Dart_GetActivationFrame(stacktrace, -1, &frame);
365 EXPECT(Dart_IsError(result)); 365 EXPECT(Dart_IsError(result));
366 366
367 Dart_SetReturnValue(args, Dart_NewInteger(42)); 367 Dart_SetReturnValue(args, Dart_NewInteger(42));
368 Dart_ExitScope(); 368 Dart_ExitScope();
369 } 369 }
370 370
371 371
372 static Dart_NativeFunction CurrentStackTraceNativeLookup( 372 static Dart_NativeFunction CurrentStackTraceNativeLookup(
373 Dart_Handle name, int argument_count) { 373 Dart_Handle name, int argument_count, bool* auto_setup_scope) {
374 ASSERT(auto_setup_scope != NULL);
375 *auto_setup_scope = false;
374 return reinterpret_cast<Dart_NativeFunction>(&CurrentStackTraceNative); 376 return reinterpret_cast<Dart_NativeFunction>(&CurrentStackTraceNative);
375 } 377 }
376 378
377 379
378 TEST_CASE(CurrentStacktraceInfo) { 380 TEST_CASE(CurrentStacktraceInfo) {
379 const char* kScriptChars = 381 const char* kScriptChars =
380 "inspectStack() native 'CurrentStackTraceNatve';\n" 382 "inspectStack() native 'CurrentStackTraceNatve';\n"
381 "foo(n) => n == 1 ? inspectStack() : foo(n-1);\n" 383 "foo(n) => n == 1 ? inspectStack() : foo(n-1);\n"
382 "testMain() => foo(50);\n"; 384 "testMain() => foo(50);\n";
383 385
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 EXPECT(Dart_IsClosure(closure)); 453 EXPECT(Dart_IsClosure(closure));
452 Dart_Handle result = Dart_InvokeClosure(closure, 0, NULL); 454 Dart_Handle result = Dart_InvokeClosure(closure, 0, NULL);
453 EXPECT(Dart_IsError(result)); 455 EXPECT(Dart_IsError(result));
454 result = Dart_PropagateError(result); 456 result = Dart_PropagateError(result);
455 EXPECT_VALID(result); // We do not expect to reach here. 457 EXPECT_VALID(result); // We do not expect to reach here.
456 UNREACHABLE(); 458 UNREACHABLE();
457 } 459 }
458 460
459 461
460 static Dart_NativeFunction PropagateError_native_lookup( 462 static Dart_NativeFunction PropagateError_native_lookup(
461 Dart_Handle name, int argument_count) { 463 Dart_Handle name, int argument_count, bool* auto_setup_scope) {
464 ASSERT(auto_setup_scope != NULL);
465 *auto_setup_scope = false;
462 return reinterpret_cast<Dart_NativeFunction>(&PropagateErrorNative); 466 return reinterpret_cast<Dart_NativeFunction>(&PropagateErrorNative);
463 } 467 }
464 468
465 469
466 TEST_CASE(Dart_PropagateError) { 470 TEST_CASE(Dart_PropagateError) {
467 const char* kScriptChars = 471 const char* kScriptChars =
468 "raiseCompileError() {\n" 472 "raiseCompileError() {\n"
469 " return missing_semicolon\n" 473 " return missing_semicolon\n"
470 "}\n" 474 "}\n"
471 "\n" 475 "\n"
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 Dart_EnterScope(); 1263 Dart_EnterScope();
1260 Dart_Handle byte_data = Dart_NewTypedData(Dart_TypedData_kByteData, kLength); 1264 Dart_Handle byte_data = Dart_NewTypedData(Dart_TypedData_kByteData, kLength);
1261 EXPECT_VALID(byte_data); 1265 EXPECT_VALID(byte_data);
1262 EXPECT_EQ(Dart_TypedData_kByteData, Dart_GetTypeOfTypedData(byte_data)); 1266 EXPECT_EQ(Dart_TypedData_kByteData, Dart_GetTypeOfTypedData(byte_data));
1263 Dart_SetReturnValue(args, byte_data); 1267 Dart_SetReturnValue(args, byte_data);
1264 Dart_ExitScope(); 1268 Dart_ExitScope();
1265 } 1269 }
1266 1270
1267 1271
1268 static Dart_NativeFunction ByteDataNativeResolver(Dart_Handle name, 1272 static Dart_NativeFunction ByteDataNativeResolver(Dart_Handle name,
1269 int arg_count) { 1273 int arg_count,
1274 bool* auto_setup_scope) {
1275 ASSERT(auto_setup_scope != NULL);
1276 *auto_setup_scope = false;
1270 return &ByteDataNativeFunction; 1277 return &ByteDataNativeFunction;
1271 } 1278 }
1272 1279
1273 1280
1274 TEST_CASE(ByteDataAccess) { 1281 TEST_CASE(ByteDataAccess) {
1275 const char* kScriptChars = 1282 const char* kScriptChars =
1276 "import 'dart:typed_data';\n" 1283 "import 'dart:typed_data';\n"
1277 "class Expect {\n" 1284 "class Expect {\n"
1278 " static equals(a, b) {\n" 1285 " static equals(a, b) {\n"
1279 " if (a != b) {\n" 1286 " if (a != b) {\n"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 Dart_Handle external_byte_data = Dart_NewExternalTypedData( 1324 Dart_Handle external_byte_data = Dart_NewExternalTypedData(
1318 Dart_TypedData_kByteData, data, 16); 1325 Dart_TypedData_kByteData, data, 16);
1319 EXPECT_VALID(external_byte_data); 1326 EXPECT_VALID(external_byte_data);
1320 EXPECT_EQ(Dart_TypedData_kByteData, 1327 EXPECT_EQ(Dart_TypedData_kByteData,
1321 Dart_GetTypeOfTypedData(external_byte_data)); 1328 Dart_GetTypeOfTypedData(external_byte_data));
1322 Dart_SetReturnValue(args, external_byte_data); 1329 Dart_SetReturnValue(args, external_byte_data);
1323 Dart_ExitScope(); 1330 Dart_ExitScope();
1324 } 1331 }
1325 1332
1326 1333
1327 static Dart_NativeFunction ExternalByteDataNativeResolver(Dart_Handle name, 1334 static Dart_NativeFunction ExternalByteDataNativeResolver(
1328 int arg_count) { 1335 Dart_Handle name, int arg_count, bool* auto_setup_scope) {
1336 ASSERT(auto_setup_scope != NULL);
1337 *auto_setup_scope = false;
1329 return &ExternalByteDataNativeFunction; 1338 return &ExternalByteDataNativeFunction;
1330 } 1339 }
1331 1340
1332 1341
1333 TEST_CASE(ExternalByteDataAccess) { 1342 TEST_CASE(ExternalByteDataAccess) {
1334 // TODO(asiva): Once we have getInt16LE and getInt16BE support use the 1343 // TODO(asiva): Once we have getInt16LE and getInt16BE support use the
1335 // appropriate getter instead of the host endian format used now. 1344 // appropriate getter instead of the host endian format used now.
1336 const char* kScriptChars = 1345 const char* kScriptChars =
1337 "import 'dart:typed_data';\n" 1346 "import 'dart:typed_data';\n"
1338 "class Expect {\n" 1347 "class Expect {\n"
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 EXPECT_STREQ("myerror", Dart_GetError(result)); 3582 EXPECT_STREQ("myerror", Dart_GetError(result));
3574 } 3583 }
3575 3584
3576 3585
3577 void NativeFieldLookup(Dart_NativeArguments args) { 3586 void NativeFieldLookup(Dart_NativeArguments args) {
3578 UNREACHABLE(); 3587 UNREACHABLE();
3579 } 3588 }
3580 3589
3581 3590
3582 static Dart_NativeFunction native_field_lookup(Dart_Handle name, 3591 static Dart_NativeFunction native_field_lookup(Dart_Handle name,
3583 int argument_count) { 3592 int argument_count,
3593 bool* auto_setup_scope) {
3594 ASSERT(auto_setup_scope != NULL);
3595 *auto_setup_scope = false;
3584 return reinterpret_cast<Dart_NativeFunction>(&NativeFieldLookup); 3596 return reinterpret_cast<Dart_NativeFunction>(&NativeFieldLookup);
3585 } 3597 }
3586 3598
3587 3599
3588 TEST_CASE(InjectNativeFields1) { 3600 TEST_CASE(InjectNativeFields1) {
3589 const char* kScriptChars = 3601 const char* kScriptChars =
3590 "class NativeFields extends NativeFieldsWrapper {\n" 3602 "class NativeFields extends NativeFieldsWrapper {\n"
3591 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n" 3603 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
3592 " int fld1;\n" 3604 " int fld1;\n"
3593 " final int fld2;\n" 3605 " final int fld2;\n"
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
4737 } 4749 }
4738 4750
4739 4751
4740 void ExceptionNative(Dart_NativeArguments args) { 4752 void ExceptionNative(Dart_NativeArguments args) {
4741 Dart_EnterScope(); 4753 Dart_EnterScope();
4742 Dart_ThrowException(NewString("Hello from ExceptionNative!")); 4754 Dart_ThrowException(NewString("Hello from ExceptionNative!"));
4743 UNREACHABLE(); 4755 UNREACHABLE();
4744 } 4756 }
4745 4757
4746 4758
4747 static Dart_NativeFunction native_lookup(Dart_Handle name, int argument_count) { 4759 static Dart_NativeFunction native_lookup(Dart_Handle name,
4760 int argument_count,
4761 bool* auto_setup_scope) {
4762 ASSERT(auto_setup_scope != NULL);
4763 *auto_setup_scope = false;
4748 return reinterpret_cast<Dart_NativeFunction>(&ExceptionNative); 4764 return reinterpret_cast<Dart_NativeFunction>(&ExceptionNative);
4749 } 4765 }
4750 4766
4751 4767
4752 TEST_CASE(ThrowException) { 4768 TEST_CASE(ThrowException) {
4753 const char* kScriptChars = 4769 const char* kScriptChars =
4754 "int test() native \"ThrowException_native\";"; 4770 "int test() native \"ThrowException_native\";";
4755 Dart_Handle result; 4771 Dart_Handle result;
4756 Isolate* isolate = Isolate::Current(); 4772 Isolate* isolate = Isolate::Current();
4757 EXPECT(isolate != NULL); 4773 EXPECT(isolate != NULL);
(...skipping 23 matching lines...) Expand all
4781 4797
4782 4798
4783 void NativeArgumentCounter(Dart_NativeArguments args) { 4799 void NativeArgumentCounter(Dart_NativeArguments args) {
4784 Dart_EnterScope(); 4800 Dart_EnterScope();
4785 int count = Dart_GetNativeArgumentCount(args); 4801 int count = Dart_GetNativeArgumentCount(args);
4786 Dart_SetReturnValue(args, Dart_NewInteger(count)); 4802 Dart_SetReturnValue(args, Dart_NewInteger(count));
4787 Dart_ExitScope(); 4803 Dart_ExitScope();
4788 } 4804 }
4789 4805
4790 4806
4791 static Dart_NativeFunction gnac_lookup(Dart_Handle name, int argument_count) { 4807 static Dart_NativeFunction gnac_lookup(Dart_Handle name,
4808 int argument_count,
4809 bool* auto_setup_scope) {
4810 ASSERT(auto_setup_scope != NULL);
4811 *auto_setup_scope = false;
4792 return reinterpret_cast<Dart_NativeFunction>(&NativeArgumentCounter); 4812 return reinterpret_cast<Dart_NativeFunction>(&NativeArgumentCounter);
4793 } 4813 }
4794 4814
4795 4815
4796 TEST_CASE(GetNativeArgumentCount) { 4816 TEST_CASE(GetNativeArgumentCount) {
4797 const char* kScriptChars = 4817 const char* kScriptChars =
4798 "class MyObject {" 4818 "class MyObject {"
4799 " int method1(int i, int j) native 'Name_Does_Not_Matter';" 4819 " int method1(int i, int j) native 'Name_Does_Not_Matter';"
4800 "}" 4820 "}"
4801 "testMain() {" 4821 "testMain() {"
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
5675 5695
5676 5696
5677 static void PatchNativeFunction(Dart_NativeArguments args) { 5697 static void PatchNativeFunction(Dart_NativeArguments args) {
5678 Dart_EnterScope(); 5698 Dart_EnterScope();
5679 Dart_SetReturnValue(args, Dart_Null()); 5699 Dart_SetReturnValue(args, Dart_Null());
5680 Dart_ExitScope(); 5700 Dart_ExitScope();
5681 } 5701 }
5682 5702
5683 5703
5684 static Dart_NativeFunction PatchNativeResolver(Dart_Handle name, 5704 static Dart_NativeFunction PatchNativeResolver(Dart_Handle name,
5685 int arg_count) { 5705 int arg_count,
5706 bool* auto_setup_scope) {
5707 ASSERT(auto_setup_scope != NULL);
5708 *auto_setup_scope = false;
5686 return &PatchNativeFunction; 5709 return &PatchNativeFunction;
5687 } 5710 }
5688 5711
5689 5712
5690 TEST_CASE(ParsePatchLibrary) { 5713 TEST_CASE(ParsePatchLibrary) {
5691 const char* kLibraryChars = 5714 const char* kLibraryChars =
5692 "library patched_library;\n" 5715 "library patched_library;\n"
5693 "class A {\n" 5716 "class A {\n"
5694 " final fvalue;\n" 5717 " final fvalue;\n"
5695 " var _f;\n" 5718 " var _f;\n"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
5869 5892
5870 5893
5871 static void MyNativeFunction2(Dart_NativeArguments args) { 5894 static void MyNativeFunction2(Dart_NativeArguments args) {
5872 Dart_EnterScope(); 5895 Dart_EnterScope();
5873 Dart_SetReturnValue(args, Dart_NewInteger(123456)); 5896 Dart_SetReturnValue(args, Dart_NewInteger(123456));
5874 Dart_ExitScope(); 5897 Dart_ExitScope();
5875 } 5898 }
5876 5899
5877 5900
5878 static Dart_NativeFunction MyNativeResolver1(Dart_Handle name, 5901 static Dart_NativeFunction MyNativeResolver1(Dart_Handle name,
5879 int arg_count) { 5902 int arg_count,
5903 bool* auto_setup_scope) {
5904 ASSERT(auto_setup_scope != NULL);
5905 *auto_setup_scope = false;
5880 return &MyNativeFunction1; 5906 return &MyNativeFunction1;
5881 } 5907 }
5882 5908
5883 5909
5884 static Dart_NativeFunction MyNativeResolver2(Dart_Handle name, 5910 static Dart_NativeFunction MyNativeResolver2(Dart_Handle name,
5885 int arg_count) { 5911 int arg_count,
5912 bool* auto_setup_scope) {
5913 ASSERT(auto_setup_scope != NULL);
5914 *auto_setup_scope = false;
5886 return &MyNativeFunction2; 5915 return &MyNativeFunction2;
5887 } 5916 }
5888 5917
5889 5918
5890 TEST_CASE(SetNativeResolver) { 5919 TEST_CASE(SetNativeResolver) {
5891 const char* kScriptChars = 5920 const char* kScriptChars =
5892 "class Test {" 5921 "class Test {"
5893 " static foo() native \"SomeNativeFunction\";" 5922 " static foo() native \"SomeNativeFunction\";"
5894 " static bar() native \"SomeNativeFunction2\";" 5923 " static bar() native \"SomeNativeFunction2\";"
5895 " static baz() native \"SomeNativeFunction3\";" 5924 " static baz() native \"SomeNativeFunction3\";"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
6336 MonitorLocker ml(sync); 6365 MonitorLocker ml(sync);
6337 main_entered = true; 6366 main_entered = true;
6338 ml.Notify(); 6367 ml.Notify();
6339 } 6368 }
6340 Dart_SetReturnValue(args, Dart_Null()); 6369 Dart_SetReturnValue(args, Dart_Null());
6341 Dart_ExitScope(); 6370 Dart_ExitScope();
6342 } 6371 }
6343 6372
6344 6373
6345 static Dart_NativeFunction IsolateInterruptTestNativeLookup( 6374 static Dart_NativeFunction IsolateInterruptTestNativeLookup(
6346 Dart_Handle name, int argument_count) { 6375 Dart_Handle name, int argument_count, bool* auto_setup_scope) {
6376 ASSERT(auto_setup_scope != NULL);
6377 *auto_setup_scope = false;
6347 return reinterpret_cast<Dart_NativeFunction>(&MarkMainEntered); 6378 return reinterpret_cast<Dart_NativeFunction>(&MarkMainEntered);
6348 } 6379 }
6349 6380
6350 6381
6351 void BusyLoop_start(uword unused) { 6382 void BusyLoop_start(uword unused) {
6352 const char* kScriptChars = 6383 const char* kScriptChars =
6353 "class Native {\n" 6384 "class Native {\n"
6354 " static void markMainEntered() native 'MarkMainEntered';\n" 6385 " static void markMainEntered() native 'MarkMainEntered';\n"
6355 "}\n" 6386 "}\n"
6356 "\n" 6387 "\n"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
6641 Dart_Handle arg2 = Dart_GetNativeArgument(args, 2); 6672 Dart_Handle arg2 = Dart_GetNativeArgument(args, 2);
6642 Dart_Handle arg3 = Dart_GetNativeArgument(args, 3); 6673 Dart_Handle arg3 = Dart_GetNativeArgument(args, 3);
6643 Dart_SetReturnValue(args, Dart_NewInteger(GetValue(arg1) + 6674 Dart_SetReturnValue(args, Dart_NewInteger(GetValue(arg1) +
6644 GetValue(arg2) + 6675 GetValue(arg2) +
6645 GetValue(arg3))); 6676 GetValue(arg3)));
6646 Dart_ExitScope(); 6677 Dart_ExitScope();
6647 } 6678 }
6648 6679
6649 6680
6650 static Dart_NativeFunction MyNativeClosureResolver(Dart_Handle name, 6681 static Dart_NativeFunction MyNativeClosureResolver(Dart_Handle name,
6651 int arg_count) { 6682 int arg_count,
6683 bool* auto_setup_scope) {
6684 ASSERT(auto_setup_scope != NULL);
6685 *auto_setup_scope = false;
6652 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); 6686 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
6653 if (!obj.IsString()) { 6687 if (!obj.IsString()) {
6654 return NULL; 6688 return NULL;
6655 } 6689 }
6656 const char* function_name = obj.ToCString(); 6690 const char* function_name = obj.ToCString();
6657 const char* kNativeFoo1 = "NativeFoo1"; 6691 const char* kNativeFoo1 = "NativeFoo1";
6658 const char* kNativeFoo2 = "NativeFoo2"; 6692 const char* kNativeFoo2 = "NativeFoo2";
6659 const char* kNativeFoo3 = "NativeFoo3"; 6693 const char* kNativeFoo3 = "NativeFoo3";
6660 const char* kNativeFoo4 = "NativeFoo4"; 6694 const char* kNativeFoo4 = "NativeFoo4";
6661 if (!strncmp(function_name, kNativeFoo1, strlen(kNativeFoo1))) { 6695 if (!strncmp(function_name, kNativeFoo1, strlen(kNativeFoo1))) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
6784 Dart_Handle arg1 = Dart_GetNativeArgument(args, 0); 6818 Dart_Handle arg1 = Dart_GetNativeArgument(args, 0);
6785 Dart_Handle arg2 = Dart_GetNativeArgument(args, 1); 6819 Dart_Handle arg2 = Dart_GetNativeArgument(args, 1);
6786 Dart_Handle arg3 = Dart_GetNativeArgument(args, 2); 6820 Dart_Handle arg3 = Dart_GetNativeArgument(args, 2);
6787 Dart_SetReturnValue(args, Dart_NewInteger(GetValue(arg1) + 6821 Dart_SetReturnValue(args, Dart_NewInteger(GetValue(arg1) +
6788 GetValue(arg2) + 6822 GetValue(arg2) +
6789 GetValue(arg3))); 6823 GetValue(arg3)));
6790 Dart_ExitScope(); 6824 Dart_ExitScope();
6791 } 6825 }
6792 6826
6793 6827
6794 static Dart_NativeFunction MyStaticNativeClosureResolver(Dart_Handle name, 6828 static Dart_NativeFunction MyStaticNativeClosureResolver(
6795 int arg_count) { 6829 Dart_Handle name, int arg_count, bool* auto_setup_scope) {
6830 ASSERT(auto_setup_scope != NULL);
6831 *auto_setup_scope = false;
6796 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); 6832 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
6797 if (!obj.IsString()) { 6833 if (!obj.IsString()) {
6798 return NULL; 6834 return NULL;
6799 } 6835 }
6800 const char* function_name = obj.ToCString(); 6836 const char* function_name = obj.ToCString();
6801 const char* kNativeFoo1 = "StaticNativeFoo1"; 6837 const char* kNativeFoo1 = "StaticNativeFoo1";
6802 const char* kNativeFoo2 = "StaticNativeFoo2"; 6838 const char* kNativeFoo2 = "StaticNativeFoo2";
6803 const char* kNativeFoo3 = "StaticNativeFoo3"; 6839 const char* kNativeFoo3 = "StaticNativeFoo3";
6804 const char* kNativeFoo4 = "StaticNativeFoo4"; 6840 const char* kNativeFoo4 = "StaticNativeFoo4";
6805 if (!strncmp(function_name, kNativeFoo1, strlen(kNativeFoo1))) { 6841 if (!strncmp(function_name, kNativeFoo1, strlen(kNativeFoo1))) {
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
7591 size, 7627 size,
7592 str_data, 7628 str_data,
7593 &ExternalStringDeoptimize_Finalize); 7629 &ExternalStringDeoptimize_Finalize);
7594 EXPECT_VALID(result); 7630 EXPECT_VALID(result);
7595 EXPECT(Dart_IsExternalString(result)); 7631 EXPECT(Dart_IsExternalString(result));
7596 Dart_ExitScope(); 7632 Dart_ExitScope();
7597 } 7633 }
7598 7634
7599 7635
7600 static Dart_NativeFunction ExternalStringDeoptimize_native_lookup( 7636 static Dart_NativeFunction ExternalStringDeoptimize_native_lookup(
7601 Dart_Handle name, int argument_count) { 7637 Dart_Handle name, int argument_count, bool* auto_setup_scope) {
7638 ASSERT(auto_setup_scope != NULL);
7639 *auto_setup_scope = false;
7602 return reinterpret_cast<Dart_NativeFunction>(&A_change_str_native); 7640 return reinterpret_cast<Dart_NativeFunction>(&A_change_str_native);
7603 } 7641 }
7604 7642
7605 7643
7606 // Do not use guarding mechanism on externalizable classes, since their class 7644 // Do not use guarding mechanism on externalizable classes, since their class
7607 // can change on the fly, 7645 // can change on the fly,
7608 TEST_CASE(GuardExternalizedString) { 7646 TEST_CASE(GuardExternalizedString) {
7609 const char* kScriptChars = 7647 const char* kScriptChars =
7610 "main() {\n" 7648 "main() {\n"
7611 " var a = new A('hello');\n" 7649 " var a = new A('hello');\n"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
7759 NewString("main"), 7797 NewString("main"),
7760 1, 7798 1,
7761 dart_args); 7799 dart_args);
7762 int64_t value = 0; 7800 int64_t value = 0;
7763 result = Dart_IntegerToInt64(result, &value); 7801 result = Dart_IntegerToInt64(result, &value);
7764 EXPECT_VALID(result); 7802 EXPECT_VALID(result);
7765 EXPECT_EQ(6, value); 7803 EXPECT_EQ(6, value);
7766 } 7804 }
7767 7805
7768 } // namespace dart 7806 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698