OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 | 1305 |
1306 TEST(CountBreakIterator) { | 1306 TEST(CountBreakIterator) { |
1307 CcTest::InitializeVM(); | 1307 CcTest::InitializeVM(); |
1308 v8::HandleScope scope(CcTest::isolate()); | 1308 v8::HandleScope scope(CcTest::isolate()); |
1309 LocalContext context; | 1309 LocalContext context; |
1310 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; | 1310 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; |
1311 global_use_counts = use_counts; | 1311 global_use_counts = use_counts; |
1312 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); | 1312 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); |
1313 CHECK_EQ(0, use_counts[v8::Isolate::kBreakIterator]); | 1313 CHECK_EQ(0, use_counts[v8::Isolate::kBreakIterator]); |
1314 v8::Local<v8::Value> result = CompileRun( | 1314 v8::Local<v8::Value> result = CompileRun( |
1315 "var iterator = Intl.v8BreakIterator(['en']);" | 1315 "(function() {" |
1316 "iterator.adoptText('Now is the time');" | 1316 " if (!this.Intl) return 0;" |
1317 "iterator.next();" | 1317 " var iterator = Intl.v8BreakIterator(['en']);" |
1318 "iterator.next();"); | 1318 " iterator.adoptText('Now is the time');" |
| 1319 " iterator.next();" |
| 1320 " return iterator.next();" |
| 1321 "})();"); |
1319 CHECK(result->IsNumber()); | 1322 CHECK(result->IsNumber()); |
1320 CHECK_EQ(1, use_counts[v8::Isolate::kBreakIterator]); | 1323 int uses = result->ToInt32()->Value() == 0 ? 0 : 1; |
| 1324 CHECK_EQ(uses, use_counts[v8::Isolate::kBreakIterator]); |
1321 } | 1325 } |
1322 | 1326 |
1323 | 1327 |
1324 TEST(StringReplaceAtomTwoByteResult) { | 1328 TEST(StringReplaceAtomTwoByteResult) { |
1325 CcTest::InitializeVM(); | 1329 CcTest::InitializeVM(); |
1326 v8::HandleScope scope(CcTest::isolate()); | 1330 v8::HandleScope scope(CcTest::isolate()); |
1327 LocalContext context; | 1331 LocalContext context; |
1328 v8::Local<v8::Value> result = CompileRun( | 1332 v8::Local<v8::Value> result = CompileRun( |
1329 "var subject = 'one_byte~only~string~'; " | 1333 "var subject = 'one_byte~only~string~'; " |
1330 "var replace = '\x80'; " | 1334 "var replace = '\x80'; " |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 CHECK(isolate->has_pending_exception()); \ | 1452 CHECK(isolate->has_pending_exception()); \ |
1449 isolate->clear_pending_exception(); \ | 1453 isolate->clear_pending_exception(); \ |
1450 dummy.Dispose(); \ | 1454 dummy.Dispose(); \ |
1451 } | 1455 } |
1452 | 1456 |
1453 INVALID_STRING_TEST(NewStringFromAscii, char) | 1457 INVALID_STRING_TEST(NewStringFromAscii, char) |
1454 INVALID_STRING_TEST(NewStringFromUtf8, char) | 1458 INVALID_STRING_TEST(NewStringFromUtf8, char) |
1455 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) | 1459 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) |
1456 | 1460 |
1457 #undef INVALID_STRING_TEST | 1461 #undef INVALID_STRING_TEST |
OLD | NEW |