Commit 17cc6d31 authored by keuchel@chromium.org's avatar keuchel@chromium.org

Revert 9673, 9674 and 9675 because of failing webkit tests.

This reverts commits
r9673: "Scope tree serialization and ScopeIterator cleanup."
r9674: "Use OS::SNPrintF instead of snprintf."
r9675: "Use int instead of size_t, StrLength instead of strlen."

Review URL: http://codereview.chromium.org/8353003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9703 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3a9d6c04
......@@ -111,16 +111,6 @@ ForInStatement::ForInStatement(Isolate* isolate, ZoneStringList* labels)
}
int FunctionLiteral::start_position() const {
return scope()->start_position();
}
int FunctionLiteral::end_position() const {
return scope()->end_position();
}
bool FunctionLiteral::strict_mode() const {
return scope()->is_strict_mode();
}
......
......@@ -1617,6 +1617,8 @@ class FunctionLiteral: public Expression {
bool has_only_simple_this_property_assignments,
Handle<FixedArray> this_property_assignments,
int num_parameters,
int start_position,
int end_position,
Type type,
bool has_duplicate_parameters)
: Expression(isolate),
......@@ -1629,6 +1631,8 @@ class FunctionLiteral: public Expression {
has_only_simple_this_property_assignments),
this_property_assignments_(this_property_assignments),
num_parameters_(num_parameters),
start_position_(start_position),
end_position_(end_position),
function_token_position_(RelocInfo::kNoPosition),
inferred_name_(HEAP->empty_string()),
is_expression_(type != DECLARATION),
......@@ -1644,8 +1648,8 @@ class FunctionLiteral: public Expression {
ZoneList<Statement*>* body() const { return body_; }
void set_function_token_position(int pos) { function_token_position_ = pos; }
int function_token_position() const { return function_token_position_; }
int start_position() const;
int end_position() const;
int start_position() const { return start_position_; }
int end_position() const { return end_position_; }
bool is_expression() const { return is_expression_; }
bool is_anonymous() const { return is_anonymous_; }
bool strict_mode() const;
......
......@@ -194,8 +194,7 @@ class Context: public FixedArray {
PREVIOUS_INDEX,
// The extension slot is used for either the global object (in global
// contexts), eval extension object (function contexts), subject of with
// (with contexts), or the variable name (catch contexts), the serialized
// scope info (block contexts).
// (with contexts), or the variable name (catch contexts).
EXTENSION_INDEX,
GLOBAL_INDEX,
MIN_CONTEXT_SLOTS,
......
......@@ -3039,9 +3039,6 @@ class SerializedScopeInfo : public FixedArray {
return reinterpret_cast<SerializedScopeInfo*>(object);
}
// Return the type of this scope.
ScopeType Type();
// Does this scope call eval?
bool CallsEval();
......@@ -3057,9 +3054,6 @@ class SerializedScopeInfo : public FixedArray {
// Return if this has context slots besides MIN_CONTEXT_SLOTS;
bool HasHeapAllocatedLocals();
// Return if contexts are allocated for this scope.
bool HasContext();
// Lookup support for serialized scope info. Returns the
// the stack slot index for a given slot name if the slot is
// present; otherwise returns a value < 0. The name must be a symbol
......
This diff is collapsed.
......@@ -678,7 +678,7 @@ class Parser {
return &empty;
}
Scope* NewScope(Scope* parent, ScopeType type);
Scope* NewScope(Scope* parent, Scope::Type type);
Handle<String> LookupSymbol(int symbol_id);
......
This diff is collapsed.
......@@ -51,7 +51,6 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
: function_name_(FACTORY->empty_symbol()),
calls_eval_(scope->calls_eval()),
is_strict_mode_(scope->is_strict_mode()),
type_(scope->type()),
parameters_(scope->num_parameters()),
stack_slots_(scope->num_stack_slots()),
context_slots_(scope->num_heap_slots()),
......@@ -151,10 +150,6 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
//
// - calls eval boolean flag
//
// - is strict mode scope
//
// - scope type
//
// - number of variables in the context object (smi) (= function context
// slot index + 1)
// - list of pairs (name, Var mode) of context-allocated variables (starting
......@@ -186,9 +181,8 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
// present)
template <class T>
static inline Object** ReadInt(Object** p, T* x) {
*x = static_cast<T>((reinterpret_cast<Smi*>(*p++))->value());
static inline Object** ReadInt(Object** p, int* x) {
*x = (reinterpret_cast<Smi*>(*p++))->value();
return p;
}
......@@ -199,21 +193,20 @@ static inline Object** ReadBool(Object** p, bool* x) {
}
template <class T>
static inline Object** ReadObject(Object** p, Handle<T>* s) {
*s = Handle<T>::cast(Handle<Object>(*p++));
static inline Object** ReadSymbol(Object** p, Handle<String>* s) {
*s = Handle<String>(reinterpret_cast<String*>(*p++));
return p;
}
template <class Allocator, class T>
static Object** ReadList(Object** p, List<Handle<T>, Allocator >* list) {
template <class Allocator>
static Object** ReadList(Object** p, List<Handle<String>, Allocator >* list) {
ASSERT(list->is_empty());
int n;
p = ReadInt(p, &n);
while (n-- > 0) {
Handle<T> s;
p = ReadObject(p, &s);
Handle<String> s;
p = ReadSymbol(p, &s);
list->Add(s);
}
return p;
......@@ -230,7 +223,7 @@ static Object** ReadList(Object** p,
while (n-- > 0) {
Handle<String> s;
int m;
p = ReadObject(p, &s);
p = ReadSymbol(p, &s);
p = ReadInt(p, &m);
list->Add(s);
modes->Add(static_cast<VariableMode>(m));
......@@ -249,10 +242,9 @@ ScopeInfo<Allocator>::ScopeInfo(SerializedScopeInfo* data)
if (data->length() > 0) {
Object** p0 = data->data_start();
Object** p = p0;
p = ReadObject(p, &function_name_);
p = ReadSymbol(p, &function_name_);
p = ReadBool(p, &calls_eval_);
p = ReadBool(p, &is_strict_mode_);
p = ReadInt(p, &type_);
p = ReadList<Allocator>(p, &context_slots_, &context_modes_);
p = ReadList<Allocator>(p, &parameters_);
p = ReadList<Allocator>(p, &stack_slots_);
......@@ -273,19 +265,18 @@ static inline Object** WriteBool(Object** p, bool b) {
}
template <class T>
static inline Object** WriteObject(Object** p, Handle<T> s) {
static inline Object** WriteSymbol(Object** p, Handle<String> s) {
*p++ = *s;
return p;
}
template <class Allocator, class T>
static Object** WriteList(Object** p, List<Handle<T>, Allocator >* list) {
template <class Allocator>
static Object** WriteList(Object** p, List<Handle<String>, Allocator >* list) {
const int n = list->length();
p = WriteInt(p, n);
for (int i = 0; i < n; i++) {
p = WriteObject(p, list->at(i));
p = WriteSymbol(p, list->at(i));
}
return p;
}
......@@ -298,7 +289,7 @@ static Object** WriteList(Object** p,
const int n = list->length();
p = WriteInt(p, n);
for (int i = 0; i < n; i++) {
p = WriteObject(p, list->at(i));
p = WriteSymbol(p, list->at(i));
p = WriteInt(p, modes->at(i));
}
return p;
......@@ -307,9 +298,8 @@ static Object** WriteList(Object** p,
template<class Allocator>
Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() {
// function name, calls eval, is_strict_mode, scope type,
// length for 3 tables:
const int extra_slots = 1 + 1 + 1 + 1 + 3;
// function name, calls eval, is_strict_mode, length for 3 tables:
const int extra_slots = 1 + 1 + 1 + 3;
int length = extra_slots +
context_slots_.length() * 2 +
parameters_.length() +
......@@ -321,10 +311,9 @@ Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() {
Object** p0 = data->data_start();
Object** p = p0;
p = WriteObject(p, function_name_);
p = WriteSymbol(p, function_name_);
p = WriteBool(p, calls_eval_);
p = WriteBool(p, is_strict_mode_);
p = WriteInt(p, type_);
p = WriteList(p, &context_slots_, &context_modes_);
p = WriteList(p, &parameters_);
p = WriteList(p, &stack_slots_);
......@@ -372,8 +361,8 @@ SerializedScopeInfo* SerializedScopeInfo::Empty() {
Object** SerializedScopeInfo::ContextEntriesAddr() {
ASSERT(length() > 0);
// +4 for function name, calls eval, strict mode, scope type.
return data_start() + 4;
// +3 for function name, calls eval, strict mode.
return data_start() + 3;
}
......@@ -417,16 +406,6 @@ bool SerializedScopeInfo::IsStrictMode() {
}
ScopeType SerializedScopeInfo::Type() {
ASSERT(length() > 0);
// +3 for function name, calls eval, strict mode.
Object** p = data_start() + 3;
ScopeType type;
p = ReadInt(p, &type);
return type;
}
int SerializedScopeInfo::NumberOfStackSlots() {
if (length() > 0) {
Object** p = StackSlotEntriesAddr();
......@@ -460,12 +439,6 @@ bool SerializedScopeInfo::HasHeapAllocatedLocals() {
}
bool SerializedScopeInfo::HasContext() {
return HasHeapAllocatedLocals() ||
Type() == WITH_SCOPE;
}
int SerializedScopeInfo::StackSlotIndex(String* name) {
ASSERT(name->IsSymbol());
if (length() > 0) {
......
......@@ -35,10 +35,17 @@
namespace v8 {
namespace internal {
// ScopeInfo represents information about different scopes of a source
// program and the allocation of the scope's variables. Scope information
// is stored in a compressed form in SerializedScopeInfo objects and is used
// Scope information represents information about a functions's
// scopes (currently only one, because we don't do any inlining)
// and the allocation of the scope's variables. Scope information
// is stored in a compressed form in FixedArray objects and is used
// at runtime (stack dumps, deoptimization, etc.).
//
// Historical note: In other VMs built by this team, ScopeInfo was
// usually called DebugInfo since the information was used (among
// other things) for on-demand debugging (Self, Smalltalk). However,
// DebugInfo seems misleading, since this information is primarily used
// in debugging-unrelated contexts.
// Forward defined as
// template <class Allocator = FreeStoreAllocationPolicy> class ScopeInfo;
......@@ -76,7 +83,6 @@ class ScopeInfo BASE_EMBEDDED {
Handle<String> LocalName(int i) const;
int NumberOfLocals() const;
ScopeType type() const { return type_; }
// --------------------------------------------------------------------------
// Debugging support
......@@ -88,7 +94,6 @@ class ScopeInfo BASE_EMBEDDED {
Handle<String> function_name_;
bool calls_eval_;
bool is_strict_mode_;
ScopeType type_;
List<Handle<String>, Allocator > parameters_;
List<Handle<String>, Allocator > stack_slots_;
List<Handle<String>, Allocator > context_slots_;
......
......@@ -114,7 +114,7 @@ Variable* VariableMap::Lookup(Handle<String> name) {
// Dummy constructor
Scope::Scope(ScopeType type)
Scope::Scope(Type type)
: isolate_(Isolate::Current()),
inner_scopes_(0),
variables_(false),
......@@ -127,7 +127,7 @@ Scope::Scope(ScopeType type)
}
Scope::Scope(Scope* outer_scope, ScopeType type)
Scope::Scope(Scope* outer_scope, Type type)
: isolate_(Isolate::Current()),
inner_scopes_(4),
variables_(),
......@@ -146,7 +146,7 @@ Scope::Scope(Scope* outer_scope, ScopeType type)
Scope::Scope(Scope* inner_scope,
ScopeType type,
Type type,
Handle<SerializedScopeInfo> scope_info)
: isolate_(Isolate::Current()),
inner_scopes_(4),
......@@ -185,7 +185,7 @@ Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name)
}
void Scope::SetDefaults(ScopeType type,
void Scope::SetDefaults(Type type,
Scope* outer_scope,
Handle<SerializedScopeInfo> scope_info) {
outer_scope_ = outer_scope;
......@@ -208,8 +208,6 @@ void Scope::SetDefaults(ScopeType type,
num_stack_slots_ = 0;
num_heap_slots_ = 0;
scope_info_ = scope_info;
start_position_ = RelocInfo::kNoPosition;
end_position_ = RelocInfo::kNoPosition;
}
......@@ -632,33 +630,15 @@ Handle<SerializedScopeInfo> Scope::GetSerializedScopeInfo() {
}
void Scope::GetNestedScopeChain(
List<Handle<SerializedScopeInfo> >* chain,
int position) {
chain->Add(Handle<SerializedScopeInfo>(GetSerializedScopeInfo()));
for (int i = 0; i < inner_scopes_.length(); i++) {
Scope* scope = inner_scopes_[i];
int beg_pos = scope->start_position();
int end_pos = scope->end_position();
ASSERT(beg_pos >= 0 && end_pos >= 0);
if (beg_pos <= position && position <= end_pos) {
scope->GetNestedScopeChain(chain, position);
return;
}
}
}
#ifdef DEBUG
static const char* Header(ScopeType type) {
static const char* Header(Scope::Type type) {
switch (type) {
case EVAL_SCOPE: return "eval";
case FUNCTION_SCOPE: return "function";
case GLOBAL_SCOPE: return "global";
case CATCH_SCOPE: return "catch";
case BLOCK_SCOPE: return "block";
case WITH_SCOPE: return "with";
case Scope::EVAL_SCOPE: return "eval";
case Scope::FUNCTION_SCOPE: return "function";
case Scope::GLOBAL_SCOPE: return "global";
case Scope::CATCH_SCOPE: return "catch";
case Scope::BLOCK_SCOPE: return "block";
case Scope::WITH_SCOPE: return "with";
}
UNREACHABLE();
return NULL;
......
......@@ -89,7 +89,16 @@ class Scope: public ZoneObject {
// ---------------------------------------------------------------------------
// Construction
Scope(Scope* outer_scope, ScopeType type);
enum Type {
EVAL_SCOPE, // The top-level scope for an eval source.
FUNCTION_SCOPE, // The top-level scope for a function.
GLOBAL_SCOPE, // The top-level scope for a program or a top-level eval.
CATCH_SCOPE, // The scope introduced by catch.
BLOCK_SCOPE, // The scope introduced by a new block.
WITH_SCOPE // The scope introduced by with.
};
Scope(Scope* outer_scope, Type type);
// Compute top scope and allocate variables. For lazy compilation the top
// scope only contains the single lazily compiled function, so this
......@@ -197,37 +206,6 @@ class Scope: public ZoneObject {
strict_mode_ = FLAG_strict_mode;
}
// Position in the source where this scope begins and ends.
//
// * For the scope of a with statement
// with (obj) stmt
// start position: start position of first token of 'stmt'
// end position: end position of last token of 'stmt'
// * For the scope of a block
// { stmts }
// start position: start position of '{'
// end position: end position of '}'
// * For the scope of a function literal or decalaration
// function fun(a,b) { stmts }
// start position: start position of '('
// end position: end position of '}'
// * For the scope of a catch block
// try { stms } catch(e) { stmts }
// start position: start position of '('
// end position: end position of ')'
// * For the scope of a for-statement
// for (let x ...) stmt
// start position: start position of '('
// end position: end position of last token of 'stmt'
int start_position() const { return start_position_; }
void set_start_position(int statement_pos) {
start_position_ = statement_pos;
}
int end_position() const { return end_position_; }
void set_end_position(int statement_pos) {
end_position_ = statement_pos;
}
// ---------------------------------------------------------------------------
// Predicates.
......@@ -266,9 +244,6 @@ class Scope: public ZoneObject {
// ---------------------------------------------------------------------------
// Accessors.
// The type of this scope.
ScopeType type() const { return type_; }
// The variable corresponding the 'this' value.
Variable* receiver() { return receiver_; }
......@@ -295,8 +270,6 @@ class Scope: public ZoneObject {
// Declarations list.
ZoneList<Declaration*>* declarations() { return &decls_; }
// Inner scope list.
ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; }
// ---------------------------------------------------------------------------
// Variable allocation.
......@@ -340,13 +313,6 @@ class Scope: public ZoneObject {
Handle<SerializedScopeInfo> GetSerializedScopeInfo();
// Get the chain of nested scopes within this scope for the source statement
// position. The scopes will be added to the list from the outermost scope to
// the innermost scope. Only nested block, catch or with scopes are tracked
// and will be returned, but no inner function scopes.
void GetNestedScopeChain(List<Handle<SerializedScopeInfo> >* chain,
int statement_position);
// ---------------------------------------------------------------------------
// Strict mode support.
bool IsDeclared(Handle<String> name) {
......@@ -370,7 +336,7 @@ class Scope: public ZoneObject {
protected:
friend class ParserFactory;
explicit Scope(ScopeType type);
explicit Scope(Type type);
Isolate* const isolate_;
......@@ -379,7 +345,7 @@ class Scope: public ZoneObject {
ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes
// The scope type.
ScopeType type_;
Type type_;
// Debugging support.
Handle<String> scope_name_;
......@@ -421,9 +387,6 @@ class Scope: public ZoneObject {
bool scope_calls_eval_;
// This scope is a strict mode scope.
bool strict_mode_;
// Source positions.
int start_position_;
int end_position_;
// Computed via PropagateScopeInfo.
bool outer_scope_calls_non_strict_eval_;
......@@ -526,9 +489,7 @@ class Scope: public ZoneObject {
private:
// Construct a scope based on the scope info.
Scope(Scope* inner_scope,
ScopeType type,
Handle<SerializedScopeInfo> scope_info);
Scope(Scope* inner_scope, Type type, Handle<SerializedScopeInfo> scope_info);
// Construct a catch scope with a binding for the name.
Scope(Scope* inner_scope, Handle<String> catch_variable_name);
......@@ -540,7 +501,7 @@ class Scope: public ZoneObject {
}
}
void SetDefaults(ScopeType type,
void SetDefaults(Type type,
Scope* outer_scope,
Handle<SerializedScopeInfo> scope_info);
};
......
......@@ -509,16 +509,6 @@ enum CallKind {
};
enum ScopeType {
EVAL_SCOPE, // The top-level scope for an eval source.
FUNCTION_SCOPE, // The top-level scope for a function.
GLOBAL_SCOPE, // The top-level scope for a program or a top-level eval.
CATCH_SCOPE, // The scope introduced by catch.
BLOCK_SCOPE, // The scope introduced by a new block.
WITH_SCOPE // The scope introduced by with.
};
static const uint32_t kHoleNanUpper32 = 0x7FFFFFFF;
static const uint32_t kHoleNanLower32 = 0xFFFFFFFF;
static const uint32_t kNaNOrInfinityLowerBoundUpper32 = 0x7FF00000;
......
......@@ -744,135 +744,3 @@ TEST(RegExpScanning) {
TestScanRegExp("/=/", "=");
TestScanRegExp("/=?/", "=?");
}
TEST(ScopePositions) {
// Test the parser for correctly setting the start and end positions
// of a scope. We check the scope positions of exactly one scope
// nested in the global scope of a program. 'inner source' is the
// source code that determines the part of the source belonging
// to the nested scope. 'outer_prefix' and 'outer_suffix' are
// parts of the source that belong to the global scope.
struct SourceData {
const char* outer_prefix;
const char* inner_source;
const char* outer_suffix;
i::ScopeType scope_type;
};
const SourceData source_data[] = {
{ " with ({}) ", "{ block; }", " more;", i::WITH_SCOPE },
{ " with ({}) ", "{ block; }", "; more;", i::WITH_SCOPE },
{ " with ({}) ", "{\n"
" block;\n"
" }", "\n"
" more;", i::WITH_SCOPE },
{ " with ({}) ", "statement;", " more;", i::WITH_SCOPE },
{ " with ({}) ", "statement", "\n"
" more;", i::WITH_SCOPE },
{ " with ({})\n"
" ", "statement;", "\n"
" more;", i::WITH_SCOPE },
{ " try {} catch ", "(e) { block; }", " more;", i::CATCH_SCOPE },
{ " try {} catch ", "(e) { block; }", "; more;", i::CATCH_SCOPE },
{ " try {} catch ", "(e) {\n"
" block;\n"
" }", "\n"
" more;", i::CATCH_SCOPE },
{ " try {} catch ", "(e) { block; }", " finally { block; } more;",
i::CATCH_SCOPE },
{ " start;\n"
" ", "{ let block; }", " more;", i::BLOCK_SCOPE },
{ " start;\n"
" ", "{ let block; }", "; more;", i::BLOCK_SCOPE },
{ " start;\n"
" ", "{\n"
" let block;\n"
" }", "\n"
" more;", i::BLOCK_SCOPE },
{ " start;\n"
" function fun", "(a,b) { infunction; }", " more;",
i::FUNCTION_SCOPE },
{ " start;\n"
" function fun", "(a,b) {\n"
" infunction;\n"
" }", "\n"
" more;", i::FUNCTION_SCOPE },
{ " (function fun", "(a,b) { infunction; }", ")();",
i::FUNCTION_SCOPE },
{ " for ", "(let x = 1 ; x < 10; ++ x) { block; }", " more;",
i::BLOCK_SCOPE },
{ " for ", "(let x = 1 ; x < 10; ++ x) { block; }", "; more;",
i::BLOCK_SCOPE },
{ " for ", "(let x = 1 ; x < 10; ++ x) {\n"
" block;\n"
" }", "\n"
" more;", i::BLOCK_SCOPE },
{ " for ", "(let x = 1 ; x < 10; ++ x) statement;", " more;",
i::BLOCK_SCOPE },
{ " for ", "(let x = 1 ; x < 10; ++ x) statement", "\n"
" more;", i::BLOCK_SCOPE },
{ " for ", "(let x = 1 ; x < 10; ++ x)\n"
" statement;", "\n"
" more;", i::BLOCK_SCOPE },
{ " for ", "(let x in {}) { block; }", " more;", i::BLOCK_SCOPE },
{ " for ", "(let x in {}) { block; }", "; more;", i::BLOCK_SCOPE },
{ " for ", "(let x in {}) {\n"
" block;\n"
" }", "\n"
" more;", i::BLOCK_SCOPE },
{ " for ", "(let x in {}) statement;", " more;", i::BLOCK_SCOPE },
{ " for ", "(let x in {}) statement", "\n"
" more;", i::BLOCK_SCOPE },
{ " for ", "(let x in {})\n"
" statement;", "\n"
" more;", i::BLOCK_SCOPE },
{ NULL, NULL, NULL, i::EVAL_SCOPE }
};
v8::HandleScope handles;
v8::Persistent<v8::Context> context = v8::Context::New();
v8::Context::Scope context_scope(context);
int marker;
i::Isolate::Current()->stack_guard()->SetStackLimit(
reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
for (int i = 0; source_data[i].outer_prefix; i++) {
int kPrefixLen = i::StrLength(source_data[i].outer_prefix);
int kInnerLen = i::StrLength(source_data[i].inner_source);
int kSuffixLen = i::StrLength(source_data[i].outer_suffix);
int kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
i::Vector<char> program = i::Vector<char>::New(kProgramSize + 1);
int length;
length = i::OS::SNPrintF(program, "%s%s%s",
source_data[i].outer_prefix,
source_data[i].inner_source,
source_data[i].outer_suffix);
ASSERT(length == kProgramSize);
// Parse program source.
i::Handle<i::String> source(
FACTORY->NewStringFromAscii(i::CStrVector(program.start())));
i::Handle<i::Script> script = FACTORY->NewScript(source);
i::Parser parser(script, false, NULL, NULL);
parser.SetHarmonyScoping(true);
i::FunctionLiteral* function =
parser.ParseProgram(source, true, i::kNonStrictMode);
ASSERT(function != NULL);
// Check scope types and positions.
i::Scope* scope = function->scope();
CHECK(scope->is_global_scope());
CHECK_EQ(scope->start_position(), 0);
CHECK_EQ(scope->end_position(), kProgramSize);
CHECK_EQ(scope->inner_scopes()->length(), 1);
i::Scope* inner_scope = scope->inner_scopes()->at(0);
CHECK_EQ(inner_scope->type(), source_data[i].scope_type);
CHECK_EQ(inner_scope->start_position(), kPrefixLen);
// The end position of a token is one position after the last
// character belonging to that token.
CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen);
}
}
// Copyright 2011 the V8 project authors. All rights reserved.
// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --allow-natives-syntax
// Flags: --expose-debug-as debug
// The functions used for testing backtraces. They are at the top to make the
// testing of source line/column easier.
......@@ -439,26 +439,6 @@ with(with_object) {
EndTest();
// With block in function that is marked for optimization while being executed.
BeginTest("With 7");
function with_7() {
with({}) {
%OptimizeFunctionOnNextCall(with_7);
debugger;
}
}
listener_delegate = function(exec_state) {
CheckScopeChain([debug.ScopeType.With,
debug.ScopeType.Local,
debug.ScopeType.Global], exec_state);
CheckScopeContent({}, 0, exec_state);
};
with_7();
EndTest();
// Simple closure formed by returning an inner function referering the outer
// functions arguments.
BeginTest("Closure 1");
......@@ -970,28 +950,6 @@ try {
EndTest();
// Catch block in function that is marked for optimization while being executed.
BeginTest("Catch block 7");
function catch_block_7() {
%OptimizeFunctionOnNextCall(catch_block_7);
try {
throw 'Exception';
} catch (e) {
debugger;
}
};
listener_delegate = function(exec_state) {
CheckScopeChain([debug.ScopeType.Catch,
debug.ScopeType.Local,
debug.ScopeType.Global], exec_state);
CheckScopeContent({e:'Exception'}, 0, exec_state);
};
catch_block_7();
EndTest();
assertEquals(begin_test_count, break_count,
'one or more tests did not enter the debugger');
assertEquals(begin_test_count, end_test_count,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment