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

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

Issue 1739593002: Revert "Move precompilation-related flags to flags list." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/debugger.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_mirrors_api.h" 7 #include "include/dart_mirrors_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "include/dart_tools_api.h" 9 #include "include/dart_tools_api.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
11 #include "platform/text_buffer.h" 11 #include "platform/text_buffer.h"
12 #include "platform/utils.h" 12 #include "platform/utils.h"
13 #include "vm/class_finalizer.h" 13 #include "vm/class_finalizer.h"
14 #include "vm/dart_api_impl.h" 14 #include "vm/dart_api_impl.h"
15 #include "vm/dart_api_state.h" 15 #include "vm/dart_api_state.h"
16 #include "vm/lockers.h" 16 #include "vm/lockers.h"
17 #include "vm/unit_test.h" 17 #include "vm/unit_test.h"
18 #include "vm/verifier.h" 18 #include "vm/verifier.h"
19 19
20 namespace dart { 20 namespace dart {
21 21
22 DECLARE_FLAG(int, optimization_counter_threshold);
22 DECLARE_FLAG(bool, verify_acquired_data); 23 DECLARE_FLAG(bool, verify_acquired_data);
23 DECLARE_FLAG(bool, ignore_patch_signature_mismatch); 24 DECLARE_FLAG(bool, ignore_patch_signature_mismatch);
24 25
25 #ifndef PRODUCT 26 #ifndef PRODUCT
26 27
27 TEST_CASE(ErrorHandleBasics) { 28 TEST_CASE(ErrorHandleBasics) {
28 const char* kScriptChars = 29 const char* kScriptChars =
29 "void testMain() {\n" 30 "void testMain() {\n"
30 " throw new Exception(\"bad news\");\n" 31 " throw new Exception(\"bad news\");\n"
31 "}\n"; 32 "}\n";
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 result = Dart_Invoke(lib, NewString("main"), 0, NULL); 1899 result = Dart_Invoke(lib, NewString("main"), 0, NULL);
1899 EXPECT_VALID(result); 1900 EXPECT_VALID(result);
1900 1901
1901 for (intptr_t i = 0; i < kExtLength; i+=2) { 1902 for (intptr_t i = 0; i < kExtLength; i+=2) {
1902 EXPECT_EQ(0x24, data[i]); 1903 EXPECT_EQ(0x24, data[i]);
1903 EXPECT_EQ(0x28, data[i+1]); 1904 EXPECT_EQ(0x28, data[i+1]);
1904 } 1905 }
1905 } 1906 }
1906 1907
1907 1908
1908 #ifndef PRODUCT
1909
1910
1911 static const intptr_t kOptExtLength = 16; 1909 static const intptr_t kOptExtLength = 16;
1912 static int8_t opt_data[kOptExtLength] = { 0x01, 0x02, 0x03, 0x04, 1910 static int8_t opt_data[kOptExtLength] = { 0x01, 0x02, 0x03, 0x04,
1913 0x05, 0x06, 0x07, 0x08, 1911 0x05, 0x06, 0x07, 0x08,
1914 0x09, 0x0a, 0x0b, 0x0c, 1912 0x09, 0x0a, 0x0b, 0x0c,
1915 0x0d, 0x0e, 0x0f, 0x10, }; 1913 0x0d, 0x0e, 0x0f, 0x10, };
1916 1914
1917 static void OptExternalByteDataNativeFunction(Dart_NativeArguments args) { 1915 static void OptExternalByteDataNativeFunction(Dart_NativeArguments args) {
1918 Dart_EnterScope(); 1916 Dart_EnterScope();
1919 Dart_Handle external_byte_data = Dart_NewExternalTypedData( 1917 Dart_Handle external_byte_data = Dart_NewExternalTypedData(
1920 Dart_TypedData_kByteData, opt_data, 16); 1918 Dart_TypedData_kByteData, opt_data, 16);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 1967
1970 // Invoke 'main' function. 1968 // Invoke 'main' function.
1971 int old_oct = FLAG_optimization_counter_threshold; 1969 int old_oct = FLAG_optimization_counter_threshold;
1972 FLAG_optimization_counter_threshold = 5; 1970 FLAG_optimization_counter_threshold = 5;
1973 result = Dart_Invoke(lib, NewString("main"), 0, NULL); 1971 result = Dart_Invoke(lib, NewString("main"), 0, NULL);
1974 EXPECT_VALID(result); 1972 EXPECT_VALID(result);
1975 FLAG_optimization_counter_threshold = old_oct; 1973 FLAG_optimization_counter_threshold = old_oct;
1976 } 1974 }
1977 1975
1978 1976
1979 #endif // !PRODUCT
1980
1981
1982 static void TestTypedDataDirectAccess() { 1977 static void TestTypedDataDirectAccess() {
1983 Dart_Handle str = Dart_NewStringFromCString("junk"); 1978 Dart_Handle str = Dart_NewStringFromCString("junk");
1984 Dart_Handle byte_array = Dart_NewTypedData(Dart_TypedData_kUint8, 10); 1979 Dart_Handle byte_array = Dart_NewTypedData(Dart_TypedData_kUint8, 10);
1985 EXPECT_VALID(byte_array); 1980 EXPECT_VALID(byte_array);
1986 Dart_Handle result; 1981 Dart_Handle result;
1987 result = Dart_TypedDataAcquireData(byte_array, NULL, NULL, NULL); 1982 result = Dart_TypedDataAcquireData(byte_array, NULL, NULL, NULL);
1988 EXPECT_ERROR(result, "Dart_TypedDataAcquireData expects argument 'type'" 1983 EXPECT_ERROR(result, "Dart_TypedDataAcquireData expects argument 'type'"
1989 " to be non-null."); 1984 " to be non-null.");
1990 Dart_TypedData_Type type; 1985 Dart_TypedData_Type type;
1991 result = Dart_TypedDataAcquireData(byte_array, &type, NULL, NULL); 1986 result = Dart_TypedDataAcquireData(byte_array, &type, NULL, NULL);
(...skipping 7776 matching lines...) Expand 10 before | Expand all | Expand 10 after
9768 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer); 9763 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer);
9769 9764
9770 // Heartbeat test for new events. 9765 // Heartbeat test for new events.
9771 EXPECT_SUBSTRING("\"name\":\"TestVMDuration2\"", buffer); 9766 EXPECT_SUBSTRING("\"name\":\"TestVMDuration2\"", buffer);
9772 EXPECT_SUBSTRING("\"function\":\"::_bar\"", buffer); 9767 EXPECT_SUBSTRING("\"function\":\"::_bar\"", buffer);
9773 } 9768 }
9774 9769
9775 #endif // !PRODUCT 9770 #endif // !PRODUCT
9776 9771
9777 } // namespace dart 9772 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698