Revision f230a1cf deps/v8/test/cctest/test-strings.cc

View differences:

deps/v8/test/cctest/test-strings.cc
137 137
                                     Zone* zone) {
138 138
  // A list of pointers that we don't have any interest in cleaning up.
139 139
  // If they are reachable from a root then leak detection won't complain.
140
  Isolate* isolate = Isolate::Current();
140
  Isolate* isolate = CcTest::i_isolate();
141 141
  Factory* factory = isolate->factory();
142 142
  for (int i = 0; i < bb_length; i++) {
143 143
    int len = rng->next(16);
......
290 290
  rng_.init();
291 291
  InitializeBuildingBlocks(
292 292
      building_blocks_, kNumberOfBuildingBlocks, long_blocks, &rng_, zone);
293
  empty_string_ = Isolate::Current()->heap()->empty_string();
293
  empty_string_ = CcTest::heap()->empty_string();
294 294
  Reset();
295 295
}
296 296

  
......
403 403

  
404 404
static Handle<String> ConstructRandomString(ConsStringGenerationData* data,
405 405
                                            unsigned max_recursion) {
406
  Factory* factory = Isolate::Current()->factory();
406
  Factory* factory = CcTest::i_isolate()->factory();
407 407
  // Compute termination characteristics.
408 408
  bool terminate = false;
409 409
  bool flat = data->rng_.next(data->empty_leaf_threshold_);
......
465 465
static Handle<String> ConstructLeft(
466 466
    ConsStringGenerationData* data,
467 467
    int depth) {
468
  Factory* factory = Isolate::Current()->factory();
468
  Factory* factory = CcTest::i_isolate()->factory();
469 469
  Handle<String> answer = factory->NewStringFromAscii(CStrVector(""));
470 470
  data->stats_.leaves_++;
471 471
  for (int i = 0; i < depth; i++) {
......
483 483
static Handle<String> ConstructRight(
484 484
    ConsStringGenerationData* data,
485 485
    int depth) {
486
  Factory* factory = Isolate::Current()->factory();
486
  Factory* factory = CcTest::i_isolate()->factory();
487 487
  Handle<String> answer = factory->NewStringFromAscii(CStrVector(""));
488 488
  data->stats_.leaves_++;
489 489
  for (int i = depth - 1; i >= 0; i--) {
......
502 502
    ConsStringGenerationData* data,
503 503
    int from,
504 504
    int to) {
505
  Factory* factory = Isolate::Current()->factory();
505
  Factory* factory = CcTest::i_isolate()->factory();
506 506
  CHECK(to > from);
507 507
  if (to - from == 1) {
508 508
    data->stats_.chars_ += data->block(from)->length();
......
571 571
  printf("TestTraverse\n");
572 572
  CcTest::InitializeVM();
573 573
  v8::HandleScope scope(CcTest::isolate());
574
  Zone zone(Isolate::Current());
574
  Zone zone(CcTest::i_isolate());
575 575
  ConsStringGenerationData data(false, &zone);
576 576
  Handle<String> flat = ConstructBalanced(&data);
577 577
  FlattenString(flat);
......
659 659
template<typename BuildString>
660 660
void TestStringCharacterStream(BuildString build, int test_cases) {
661 661
  CcTest::InitializeVM();
662
  Isolate* isolate = Isolate::Current();
662
  Isolate* isolate = CcTest::i_isolate();
663 663
  HandleScope outer_scope(isolate);
664 664
  Zone zone(isolate);
665 665
  ConsStringGenerationData data(true, &zone);
......
697 697

  
698 698
static Handle<String> BuildEdgeCaseConsString(
699 699
    int test_case, ConsStringGenerationData* data) {
700
  Factory* factory = Isolate::Current()->factory();
700
  Factory* factory = CcTest::i_isolate()->factory();
701 701
  data->Reset();
702 702
  switch (test_case) {
703 703
    case 0:
......
860 860
TEST(DeepAscii) {
861 861
  printf("TestDeepAscii\n");
862 862
  CcTest::InitializeVM();
863
  Factory* factory = Isolate::Current()->factory();
863
  Factory* factory = CcTest::i_isolate()->factory();
864 864
  v8::HandleScope scope(CcTest::isolate());
865 865

  
866 866
  char* foo = NewArray<char>(DEEP_ASCII_DEPTH);
......
930 930

  
931 931

  
932 932
TEST(ExternalShortStringAdd) {
933
  Isolate* isolate = Isolate::Current();
933
  Isolate* isolate = CcTest::i_isolate();
934 934
  Zone zone(isolate);
935 935

  
936
  CcTest::InitializeVM();
936
  LocalContext context;
937 937
  v8::HandleScope handle_scope(CcTest::isolate());
938 938

  
939 939
  // Make sure we cover all always-flat lengths and at least one above.
......
974 974
  }
975 975

  
976 976
  // Add the arrays with the short external strings in the global object.
977
  v8::Handle<v8::Object> global = CcTest::env()->Global();
977
  v8::Handle<v8::Object> global = context->Global();
978 978
  global->Set(v8_str("external_ascii"), ascii_external_strings);
979 979
  global->Set(v8_str("external_non_ascii"), non_ascii_external_strings);
980 980
  global->Set(v8_str("max_length"), v8::Integer::New(kMaxLength));
......
1018 1018

  
1019 1019

  
1020 1020
TEST(JSONStringifySliceMadeExternal) {
1021
  Isolate* isolate = Isolate::Current();
1022
  Zone zone(isolate);
1023 1021
  CcTest::InitializeVM();
1022
  Isolate* isolate = CcTest::i_isolate();
1023
  Zone zone(isolate);
1024 1024
  // Create a sliced string from a one-byte string.  The latter is turned
1025 1025
  // into a two-byte external string.  Check that JSON.stringify works.
1026 1026
  v8::HandleScope handle_scope(CcTest::isolate());
......
1048 1048

  
1049 1049

  
1050 1050
TEST(CachedHashOverflow) {
1051
  CcTest::InitializeVM();
1051 1052
  // We incorrectly allowed strings to be tagged as array indices even if their
1052 1053
  // values didn't fit in the hash field.
1053 1054
  // See http://code.google.com/p/v8/issues/detail?id=728
1054
  Isolate* isolate = Isolate::Current();
1055
  Isolate* isolate = CcTest::i_isolate();
1055 1056
  Zone zone(isolate);
1056 1057

  
1057
  CcTest::InitializeVM();
1058 1058
  v8::HandleScope handle_scope(CcTest::isolate());
1059 1059
  // Lines must be executed sequentially. Combining them into one script
1060 1060
  // makes the bug go away.
......
1098 1098
TEST(SliceFromCons) {
1099 1099
  FLAG_string_slices = true;
1100 1100
  CcTest::InitializeVM();
1101
  Factory* factory = Isolate::Current()->factory();
1101
  Factory* factory = CcTest::i_isolate()->factory();
1102 1102
  v8::HandleScope scope(CcTest::isolate());
1103 1103
  Handle<String> string =
1104 1104
      factory->NewStringFromAscii(CStrVector("parentparentparent"));
......
1133 1133
TEST(SliceFromExternal) {
1134 1134
  FLAG_string_slices = true;
1135 1135
  CcTest::InitializeVM();
1136
  Factory* factory = Isolate::Current()->factory();
1136
  Factory* factory = CcTest::i_isolate()->factory();
1137 1137
  v8::HandleScope scope(CcTest::isolate());
1138 1138
  AsciiVectorResource resource(
1139 1139
      i::Vector<const char>("abcdefghijklmnopqrstuvwxyz", 26));
......
1153 1153
  // actually creates a new string (it should not).
1154 1154
  FLAG_string_slices = true;
1155 1155
  CcTest::InitializeVM();
1156
  Factory* factory = Isolate::Current()->factory();
1156
  Factory* factory = CcTest::i_isolate()->factory();
1157 1157
  v8::HandleScope scope(CcTest::isolate());
1158 1158
  v8::Local<v8::Value> result;
1159 1159
  Handle<String> string;
......
1227 1227
      "for (var i = 1; i <= two_14; i++) a.push(s);"
1228 1228
      "a.join("");";
1229 1229

  
1230
  v8::HandleScope scope(v8::Isolate::GetCurrent());
1230
  v8::HandleScope scope(CcTest::isolate());
1231 1231
  LocalContext context;
1232 1232
  v8::V8::IgnoreOutOfMemoryException();
1233 1233
  v8::Local<v8::Script> script =

Also available in: Unified diff