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

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

Issue 7685005: Inserted a missing string encoding check in lastIndexOf. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Included a test case. Created 9 years, 4 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 | Annotate | Revision Log
« src/runtime.cc ('K') | « src/string.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 13675 matching lines...) Expand 10 before | Expand all | Expand 10 after
13686 // See Chromium issue 47824. 13686 // See Chromium issue 47824.
13687 v8::HandleScope scope; 13687 v8::HandleScope scope;
13688 13688
13689 LocalContext context; 13689 LocalContext context;
13690 const char* init_code = 13690 const char* init_code =
13691 "var str1 = 'abelspendabel';" 13691 "var str1 = 'abelspendabel';"
13692 "var str2 = str1 + str1 + str1;" 13692 "var str2 = str1 + str1 + str1;"
13693 "str2;"; 13693 "str2;";
13694 Local<Value> result = CompileRun(init_code); 13694 Local<Value> result = CompileRun(init_code);
13695 13695
13696 Local<Value> indexof = CompileRun("str2.indexOf('els')");
13697 Local<Value> lastindexof = CompileRun("str2.lastIndexOf('dab')");
13698
13696 CHECK(result->IsString()); 13699 CHECK(result->IsString());
13697 i::Handle<i::String> string = v8::Utils::OpenHandle(String::Cast(*result)); 13700 i::Handle<i::String> string = v8::Utils::OpenHandle(String::Cast(*result));
13698 int length = string->length(); 13701 int length = string->length();
13699 CHECK(string->IsAsciiRepresentation()); 13702 CHECK(string->IsAsciiRepresentation());
13700 13703
13701 FlattenString(string); 13704 FlattenString(string);
13702 i::Handle<i::String> flat_string = FlattenGetString(string); 13705 i::Handle<i::String> flat_string = FlattenGetString(string);
13703 13706
13704 CHECK(string->IsAsciiRepresentation()); 13707 CHECK(string->IsAsciiRepresentation());
13705 CHECK(flat_string->IsAsciiRepresentation()); 13708 CHECK(flat_string->IsAsciiRepresentation());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
13751 13754
13752 reresult = CompileRun("/be./g.exec(str2);"); 13755 reresult = CompileRun("/be./g.exec(str2);");
13753 CHECK(!reresult->IsNull()); 13756 CHECK(!reresult->IsNull());
13754 13757
13755 ExpectString("str2.substring(2, 10);", "elspenda"); 13758 ExpectString("str2.substring(2, 10);", "elspenda");
13756 13759
13757 ExpectString("str2.substring(2, 20);", "elspendabelabelspe"); 13760 ExpectString("str2.substring(2, 20);", "elspendabelabelspe");
13758 13761
13759 ExpectString("str2.charAt(2);", "e"); 13762 ExpectString("str2.charAt(2);", "e");
13760 13763
13764 ExpectObject("str2.indexOf('els');", indexof);
13765
13766 ExpectObject("str2.lastIndexOf('dab');", lastindexof);
13767
13761 reresult = CompileRun("str2.charCodeAt(2);"); 13768 reresult = CompileRun("str2.charCodeAt(2);");
13762 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value()); 13769 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value());
13763 } 13770 }
13764 13771
13765 13772
13766 // Failed access check callback that performs a GC on each invocation. 13773 // Failed access check callback that performs a GC on each invocation.
13767 void FailedAccessCheckCallbackGC(Local<v8::Object> target, 13774 void FailedAccessCheckCallbackGC(Local<v8::Object> target,
13768 v8::AccessType type, 13775 v8::AccessType type,
13769 Local<v8::Value> data) { 13776 Local<v8::Value> data) {
13770 HEAP->CollectAllGarbage(true); 13777 HEAP->CollectAllGarbage(true);
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
14889 } 14896 }
14890 14897
14891 i::Isolate::Current()->heap()->CollectAllGarbage(true); 14898 i::Isolate::Current()->heap()->CollectAllGarbage(true);
14892 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); 14899 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache();
14893 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { 14900 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) {
14894 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); 14901 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache);
14895 CHECK_GT(elements, map_cache->NumberOfElements()); 14902 CHECK_GT(elements, map_cache->NumberOfElements());
14896 } 14903 }
14897 } 14904 }
14898 } 14905 }
OLDNEW
« src/runtime.cc ('K') | « src/string.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698