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

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

Issue 8725001: Reapply "Fix the ScopeIterator reimplementation". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use BreakLocationIterator to discover break at return. Created 9 years 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // the block could be lazily compiled, and an extra, unexpected, 342 // the block could be lazily compiled, and an extra, unexpected,
343 // entry was added to the data. 343 // entry was added to the data.
344 int marker; 344 int marker;
345 i::Isolate::Current()->stack_guard()->SetStackLimit( 345 i::Isolate::Current()->stack_guard()->SetStackLimit(
346 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); 346 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
347 347
348 const char* program = 348 const char* program =
349 "try { } catch (e) { var foo = function () { /* first */ } }" 349 "try { } catch (e) { var foo = function () { /* first */ } }"
350 "var bar = function () { /* second */ }"; 350 "var bar = function () { /* second */ }";
351 351
352 i::Utf8ToUC16CharacterStream stream(reinterpret_cast<const i::byte*>(program), 352 v8::HandleScope handles;
353 static_cast<unsigned>(strlen(program))); 353 i::Handle<i::String> source(
354 i::ScriptDataImpl* data = 354 FACTORY->NewStringFromAscii(i::CStrVector(program)));
355 i::ParserApi::PartialPreParse(&stream, NULL, false); 355 i::ScriptDataImpl* data = i::ParserApi::PartialPreParse(source, NULL, false);
356 CHECK(!data->HasError()); 356 CHECK(!data->HasError());
357 357
358 data->Initialize(); 358 data->Initialize();
359 359
360 int first_function = 360 int first_function =
361 static_cast<int>(strstr(program, "function") - program); 361 static_cast<int>(strstr(program, "function") - program);
362 int first_lbrace = first_function + static_cast<int>(strlen("function () ")); 362 int first_lbrace = first_function + static_cast<int>(strlen("function () "));
363 CHECK_EQ('{', program[first_lbrace]); 363 CHECK_EQ('{', program[first_lbrace]);
364 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace); 364 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace);
365 CHECK(!entry1.is_valid()); 365 CHECK(!entry1.is_valid());
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 CHECK_EQ(scope->inner_scopes()->length(), 1); 877 CHECK_EQ(scope->inner_scopes()->length(), 1);
878 878
879 i::Scope* inner_scope = scope->inner_scopes()->at(0); 879 i::Scope* inner_scope = scope->inner_scopes()->at(0);
880 CHECK_EQ(inner_scope->type(), source_data[i].scope_type); 880 CHECK_EQ(inner_scope->type(), source_data[i].scope_type);
881 CHECK_EQ(inner_scope->start_position(), kPrefixLen); 881 CHECK_EQ(inner_scope->start_position(), kPrefixLen);
882 // The end position of a token is one position after the last 882 // The end position of a token is one position after the last
883 // character belonging to that token. 883 // character belonging to that token.
884 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen); 884 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen);
885 } 885 }
886 } 886 }
OLDNEW
« src/parser.cc ('K') | « src/scopes.cc ('k') | test/mjsunit/debug-stepout-scope.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698