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

Side by Side Diff: test/cctest/test-strings.cc

Issue 2758563002: [gn] Enable stricter build flags (Closed)
Patch Set: Address comment Created 3 years, 9 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 | « test/cctest/interpreter/test-interpreter.cc ('k') | test/inspector/inspector-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 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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 TEST(CachedHashOverflow) { 1107 TEST(CachedHashOverflow) {
1108 CcTest::InitializeVM(); 1108 CcTest::InitializeVM();
1109 // We incorrectly allowed strings to be tagged as array indices even if their 1109 // We incorrectly allowed strings to be tagged as array indices even if their
1110 // values didn't fit in the hash field. 1110 // values didn't fit in the hash field.
1111 // See http://code.google.com/p/v8/issues/detail?id=728 1111 // See http://code.google.com/p/v8/issues/detail?id=728
1112 Isolate* isolate = CcTest::i_isolate(); 1112 Isolate* isolate = CcTest::i_isolate();
1113 1113
1114 v8::HandleScope handle_scope(CcTest::isolate()); 1114 v8::HandleScope handle_scope(CcTest::isolate());
1115 // Lines must be executed sequentially. Combining them into one script 1115 // Lines must be executed sequentially. Combining them into one script
1116 // makes the bug go away. 1116 // makes the bug go away.
1117 const char* lines[] = { 1117 const char* lines[] = {"var x = [];", "x[4] = 42;", "var s = \"1073741828\";",
1118 "var x = [];", 1118 "x[s];", "x[s] = 37;", "x[4];",
1119 "x[4] = 42;", 1119 "x[s];"};
1120 "var s = \"1073741828\";",
1121 "x[s];",
1122 "x[s] = 37;",
1123 "x[4];",
1124 "x[s];",
1125 NULL
1126 };
1127 1120
1128 Handle<Smi> fortytwo(Smi::FromInt(42), isolate); 1121 Handle<Smi> fortytwo(Smi::FromInt(42), isolate);
1129 Handle<Smi> thirtyseven(Smi::FromInt(37), isolate); 1122 Handle<Smi> thirtyseven(Smi::FromInt(37), isolate);
1130 Handle<Object> results[] = { isolate->factory()->undefined_value(), 1123 Handle<Object> results[] = { isolate->factory()->undefined_value(),
1131 fortytwo, 1124 fortytwo,
1132 isolate->factory()->undefined_value(), 1125 isolate->factory()->undefined_value(),
1133 isolate->factory()->undefined_value(), 1126 isolate->factory()->undefined_value(),
1134 thirtyseven, 1127 thirtyseven,
1135 fortytwo, 1128 fortytwo,
1136 thirtyseven // Bug yielded 42 here. 1129 thirtyseven // Bug yielded 42 here.
1137 }; 1130 };
1138 1131
1139 const char* line;
1140 v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext(); 1132 v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
1141 for (int i = 0; (line = lines[i]); i++) { 1133 for (size_t i = 0; i < arraysize(lines); i++) {
1134 const char* line = lines[i];
1142 printf("%s\n", line); 1135 printf("%s\n", line);
1143 v8::Local<v8::Value> result = 1136 v8::Local<v8::Value> result =
1144 v8::Script::Compile(context, 1137 v8::Script::Compile(context,
1145 v8::String::NewFromUtf8(CcTest::isolate(), line, 1138 v8::String::NewFromUtf8(CcTest::isolate(), line,
1146 v8::NewStringType::kNormal) 1139 v8::NewStringType::kNormal)
1147 .ToLocalChecked()) 1140 .ToLocalChecked())
1148 .ToLocalChecked() 1141 .ToLocalChecked()
1149 ->Run(context) 1142 ->Run(context)
1150 .ToLocalChecked(); 1143 .ToLocalChecked();
1151 CHECK_EQ(results[i]->IsUndefined(CcTest::i_isolate()), 1144 CHECK_EQ(results[i]->IsUndefined(CcTest::i_isolate()),
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 CHECK_EQ(1, CompileRun("external.indexOf('', 1)") 1657 CHECK_EQ(1, CompileRun("external.indexOf('', 1)")
1665 ->Int32Value(context.local()) 1658 ->Int32Value(context.local())
1666 .FromJust()); 1659 .FromJust());
1667 CHECK_EQ(-1, CompileRun("external.indexOf('a', 1)") 1660 CHECK_EQ(-1, CompileRun("external.indexOf('a', 1)")
1668 ->Int32Value(context.local()) 1661 ->Int32Value(context.local())
1669 .FromJust()); 1662 .FromJust());
1670 CHECK_EQ(-1, CompileRun("external.indexOf('$')") 1663 CHECK_EQ(-1, CompileRun("external.indexOf('$')")
1671 ->Int32Value(context.local()) 1664 ->Int32Value(context.local())
1672 .FromJust()); 1665 .FromJust());
1673 } 1666 }
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | test/inspector/inspector-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698