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

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

Issue 7565003: Revert "Revert "Fix a bug in scope analysis."" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update test expectation. 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
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 10645 matching lines...) Expand 10 before | Expand all | Expand 10 after
10656 v8::TryCatch try_catch; 10656 v8::TryCatch try_catch;
10657 10657
10658 Local<String> source = String::New(script); 10658 Local<String> source = String::New(script);
10659 Local<Script> compiled_script = Script::New(source, NULL, sd); 10659 Local<Script> compiled_script = Script::New(source, NULL, sd);
10660 CHECK(try_catch.HasCaught()); 10660 CHECK(try_catch.HasCaught());
10661 String::AsciiValue exception_value(try_catch.Message()->Get()); 10661 String::AsciiValue exception_value(try_catch.Message()->Get());
10662 CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar", 10662 CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar",
10663 *exception_value); 10663 *exception_value);
10664 10664
10665 try_catch.Reset(); 10665 try_catch.Reset();
10666
10666 // Overwrite function bar's start position with 200. The function entry 10667 // Overwrite function bar's start position with 200. The function entry
10667 // will not be found when searching for it by position. 10668 // will not be found when searching for it by position and we should fall
10669 // back on eager compilation.
10668 sd = v8::ScriptData::PreCompile(script, i::StrLength(script)); 10670 sd = v8::ScriptData::PreCompile(script, i::StrLength(script));
10669 sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data())); 10671 sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
10670 sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] = 10672 sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] =
10671 200; 10673 200;
10672 compiled_script = Script::New(source, NULL, sd); 10674 compiled_script = Script::New(source, NULL, sd);
10673 CHECK(try_catch.HasCaught()); 10675 CHECK(!try_catch.HasCaught());
10674 String::AsciiValue second_exception_value(try_catch.Message()->Get());
10675 CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar",
10676 *second_exception_value);
10677 10676
10678 delete sd; 10677 delete sd;
10679 } 10678 }
10680 10679
10681 10680
10682 // Verifies that the Handle<String> and const char* versions of the API produce 10681 // Verifies that the Handle<String> and const char* versions of the API produce
10683 // the same results (at least for one trivial case). 10682 // the same results (at least for one trivial case).
10684 TEST(PreCompileAPIVariationsAreSame) { 10683 TEST(PreCompileAPIVariationsAreSame) {
10685 v8::V8::Initialize(); 10684 v8::V8::Initialize();
10686 v8::HandleScope scope; 10685 v8::HandleScope scope;
(...skipping 4143 matching lines...) Expand 10 before | Expand all | Expand 10 after
14830 } 14829 }
14831 14830
14832 i::Isolate::Current()->heap()->CollectAllGarbage(true); 14831 i::Isolate::Current()->heap()->CollectAllGarbage(true);
14833 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); 14832 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache();
14834 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { 14833 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) {
14835 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); 14834 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache);
14836 CHECK_GT(elements, map_cache->NumberOfElements()); 14835 CHECK_GT(elements, map_cache->NumberOfElements());
14837 } 14836 }
14838 } 14837 }
14839 } 14838 }
OLDNEW
« src/parser.cc ('K') | « src/parser.cc ('k') | test/mjsunit/regress/regress-91120.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698