mirror of https://github.com/lukechilds/node.git
Ryan
16 years ago
124 changed files with 7951 additions and 2392 deletions
@ -0,0 +1,45 @@ |
|||
// Copyright 2009 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:
|
|||
//
|
|||
// * Redistributions of source code must retain the above copyright
|
|||
// notice, this list of conditions and the following disclaimer.
|
|||
// * Redistributions in binary form must reproduce the above
|
|||
// copyright notice, this list of conditions and the following
|
|||
// disclaimer in the documentation and/or other materials provided
|
|||
// with the distribution.
|
|||
// * Neither the name of Google Inc. nor the names of its
|
|||
// contributors may be used to endorse or promote products derived
|
|||
// from this software without specific prior written permission.
|
|||
//
|
|||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
|||
#include "v8.h" |
|||
|
|||
#include "frame-element.h" |
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
|
|||
// -------------------------------------------------------------------------
|
|||
// FrameElement implementation.
|
|||
|
|||
|
|||
FrameElement::ZoneObjectList* FrameElement::ConstantList() { |
|||
static ZoneObjectList list(10); |
|||
return &list; |
|||
} |
|||
|
|||
|
|||
} } // namespace v8::internal
|
@ -1,260 +0,0 @@ |
|||
// 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:
|
|||
//
|
|||
// * Redistributions of source code must retain the above copyright
|
|||
// notice, this list of conditions and the following disclaimer.
|
|||
// * Redistributions in binary form must reproduce the above
|
|||
// copyright notice, this list of conditions and the following
|
|||
// disclaimer in the documentation and/or other materials provided
|
|||
// with the distribution.
|
|||
// * Neither the name of Google Inc. nor the names of its
|
|||
// contributors may be used to endorse or promote products derived
|
|||
// from this software without specific prior written permission.
|
|||
//
|
|||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
|||
#ifndef V8_JSREGEXP_INL_H_ |
|||
#define V8_JSREGEXP_INL_H_ |
|||
|
|||
|
|||
#include "jsregexp.h" |
|||
#include "regexp-macro-assembler.h" |
|||
|
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
|
|||
|
|||
template <typename C> |
|||
bool ZoneSplayTree<C>::Insert(const Key& key, Locator* locator) { |
|||
if (is_empty()) { |
|||
// If the tree is empty, insert the new node.
|
|||
root_ = new Node(key, C::kNoValue); |
|||
} else { |
|||
// Splay on the key to move the last node on the search path
|
|||
// for the key to the root of the tree.
|
|||
Splay(key); |
|||
// Ignore repeated insertions with the same key.
|
|||
int cmp = C::Compare(key, root_->key_); |
|||
if (cmp == 0) { |
|||
locator->bind(root_); |
|||
return false; |
|||
} |
|||
// Insert the new node.
|
|||
Node* node = new Node(key, C::kNoValue); |
|||
if (cmp > 0) { |
|||
node->left_ = root_; |
|||
node->right_ = root_->right_; |
|||
root_->right_ = NULL; |
|||
} else { |
|||
node->right_ = root_; |
|||
node->left_ = root_->left_; |
|||
root_->left_ = NULL; |
|||
} |
|||
root_ = node; |
|||
} |
|||
locator->bind(root_); |
|||
return true; |
|||
} |
|||
|
|||
|
|||
template <typename C> |
|||
bool ZoneSplayTree<C>::Find(const Key& key, Locator* locator) { |
|||
if (is_empty()) |
|||
return false; |
|||
Splay(key); |
|||
if (C::Compare(key, root_->key_) == 0) { |
|||
locator->bind(root_); |
|||
return true; |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
|
|||
template <typename C> |
|||
bool ZoneSplayTree<C>::FindGreatestLessThan(const Key& key, |
|||
Locator* locator) { |
|||
if (is_empty()) |
|||
return false; |
|||
// Splay on the key to move the node with the given key or the last
|
|||
// node on the search path to the top of the tree.
|
|||
Splay(key); |
|||
// Now the result is either the root node or the greatest node in
|
|||
// the left subtree.
|
|||
int cmp = C::Compare(root_->key_, key); |
|||
if (cmp <= 0) { |
|||
locator->bind(root_); |
|||
return true; |
|||
} else { |
|||
Node* temp = root_; |
|||
root_ = root_->left_; |
|||
bool result = FindGreatest(locator); |
|||
root_ = temp; |
|||
return result; |
|||
} |
|||
} |
|||
|
|||
|
|||
template <typename C> |
|||
bool ZoneSplayTree<C>::FindLeastGreaterThan(const Key& key, |
|||
Locator* locator) { |
|||
if (is_empty()) |
|||
return false; |
|||
// Splay on the key to move the node with the given key or the last
|
|||
// node on the search path to the top of the tree.
|
|||
Splay(key); |
|||
// Now the result is either the root node or the least node in
|
|||
// the right subtree.
|
|||
int cmp = C::Compare(root_->key_, key); |
|||
if (cmp >= 0) { |
|||
locator->bind(root_); |
|||
return true; |
|||
} else { |
|||
Node* temp = root_; |
|||
root_ = root_->right_; |
|||
bool result = FindLeast(locator); |
|||
root_ = temp; |
|||
return result; |
|||
} |
|||
} |
|||
|
|||
|
|||
template <typename C> |
|||
bool ZoneSplayTree<C>::FindGreatest(Locator* locator) { |
|||
if (is_empty()) |
|||
return false; |
|||
Node* current = root_; |
|||
while (current->right_ != NULL) |
|||
current = current->right_; |
|||
locator->bind(current); |
|||
return true; |
|||
} |
|||
|
|||
|
|||
template <typename C> |
|||
bool ZoneSplayTree<C>::FindLeast(Locator* locator) { |
|||
if (is_empty()) |
|||
return false; |
|||
Node* current = root_; |
|||
while (current->left_ != NULL) |
|||
current = current->left_; |
|||
locator->bind(current); |
|||
return true; |
|||
} |
|||
|
|||
|
|||
template <typename C> |
|||
bool ZoneSplayTree<C>::Remove(const Key& key) { |
|||
// Bail if the tree is empty
|
|||
if (is_empty()) |
|||
return false; |
|||
// Splay on the key to move the node with the given key to the top.
|
|||
Splay(key); |
|||
// Bail if the key is not in the tree
|
|||
if (C::Compare(key, root_->key_) != 0) |
|||
return false; |
|||
if (root_->left_ == NULL) { |
|||
// No left child, so the new tree is just the right child.
|
|||
root_ = root_->right_; |
|||
} else { |
|||
// Left child exists.
|
|||
Node* right = root_->right_; |
|||
// Make the original left child the new root.
|
|||
root_ = root_->left_; |
|||
// Splay to make sure that the new root has an empty right child.
|
|||
Splay(key); |
|||
// Insert the original right child as the right child of the new
|
|||
// root.
|
|||
root_->right_ = right; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
|
|||
template <typename C> |
|||
void ZoneSplayTree<C>::Splay(const Key& key) { |
|||
if (is_empty()) |
|||
return; |
|||
Node dummy_node(C::kNoKey, C::kNoValue); |
|||
// Create a dummy node. The use of the dummy node is a bit
|
|||
// counter-intuitive: The right child of the dummy node will hold
|
|||
// the L tree of the algorithm. The left child of the dummy node
|
|||
// will hold the R tree of the algorithm. Using a dummy node, left
|
|||
// and right will always be nodes and we avoid special cases.
|
|||
Node* dummy = &dummy_node; |
|||
Node* left = dummy; |
|||
Node* right = dummy; |
|||
Node* current = root_; |
|||
while (true) { |
|||
int cmp = C::Compare(key, current->key_); |
|||
if (cmp < 0) { |
|||
if (current->left_ == NULL) |
|||
break; |
|||
if (C::Compare(key, current->left_->key_) < 0) { |
|||
// Rotate right.
|
|||
Node* temp = current->left_; |
|||
current->left_ = temp->right_; |
|||
temp->right_ = current; |
|||
current = temp; |
|||
if (current->left_ == NULL) |
|||
break; |
|||
} |
|||
// Link right.
|
|||
right->left_ = current; |
|||
right = current; |
|||
current = current->left_; |
|||
} else if (cmp > 0) { |
|||
if (current->right_ == NULL) |
|||
break; |
|||
if (C::Compare(key, current->right_->key_) > 0) { |
|||
// Rotate left.
|
|||
Node* temp = current->right_; |
|||
current->right_ = temp->left_; |
|||
temp->left_ = current; |
|||
current = temp; |
|||
if (current->right_ == NULL) |
|||
break; |
|||
} |
|||
// Link left.
|
|||
left->right_ = current; |
|||
left = current; |
|||
current = current->right_; |
|||
} else { |
|||
break; |
|||
} |
|||
} |
|||
// Assemble.
|
|||
left->right_ = current->left_; |
|||
right->left_ = current->right_; |
|||
current->left_ = dummy->right_; |
|||
current->right_ = dummy->left_; |
|||
root_ = current; |
|||
} |
|||
|
|||
|
|||
template <typename Node, class Callback> |
|||
static void DoForEach(Node* node, Callback* callback) { |
|||
if (node == NULL) return; |
|||
DoForEach<Node, Callback>(node->left(), callback); |
|||
callback->Call(node->key(), node->value()); |
|||
DoForEach<Node, Callback>(node->right(), callback); |
|||
} |
|||
|
|||
|
|||
}} // namespace v8::internal
|
|||
|
|||
|
|||
#endif // V8_JSREGEXP_INL_H_
|
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,248 @@ |
|||
// 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:
|
|||
//
|
|||
// * Redistributions of source code must retain the above copyright
|
|||
// notice, this list of conditions and the following disclaimer.
|
|||
// * Redistributions in binary form must reproduce the above
|
|||
// copyright notice, this list of conditions and the following
|
|||
// disclaimer in the documentation and/or other materials provided
|
|||
// with the distribution.
|
|||
// * Neither the name of Google Inc. nor the names of its
|
|||
// contributors may be used to endorse or promote products derived
|
|||
// from this software without specific prior written permission.
|
|||
//
|
|||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
// (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
|
|||
|
|||
// Get the Debug object exposed from the debug context global object.
|
|||
Debug = debug.Debug |
|||
|
|||
var exception = null; |
|||
var state = 1; |
|||
var expected_source_line_text = null; |
|||
var expected_function_name = null; |
|||
|
|||
// Simple debug event handler which first time will cause 'step in' action
|
|||
// to get into g.call and than check that execution is pauesed inside
|
|||
// function 'g'.
|
|||
function listener(event, exec_state, event_data, data) { |
|||
try { |
|||
if (event == Debug.DebugEvent.Break) { |
|||
if (state == 1) { |
|||
exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
|||
state = 2; |
|||
} else if (state == 2) { |
|||
assertEquals(expected_source_line_text, |
|||
event_data.sourceLineText()); |
|||
assertEquals(expected_function_name, event_data.func().name()); |
|||
state = 3; |
|||
} |
|||
} |
|||
} catch(e) { |
|||
exception = e; |
|||
} |
|||
}; |
|||
|
|||
// Add the debug event listener.
|
|||
Debug.setListener(listener); |
|||
|
|||
|
|||
var c = { |
|||
name: 'name ', |
|||
get getter1() { |
|||
return this.name; // getter 1
|
|||
}, |
|||
get getter2() { |
|||
return { // getter 2
|
|||
'a': c.name |
|||
}; |
|||
}, |
|||
set setter1(n) { |
|||
this.name = n; // setter 1
|
|||
} |
|||
}; |
|||
|
|||
c.__defineGetter__('y', function getterY() { |
|||
return this.name; // getter y
|
|||
}); |
|||
|
|||
c.__defineGetter__(3, function getter3() { |
|||
return this.name; // getter 3
|
|||
}); |
|||
|
|||
c.__defineSetter__('y', function setterY(n) { |
|||
this.name = n; // setter y
|
|||
}); |
|||
|
|||
c.__defineSetter__(3, function setter3(n) { |
|||
this.name = n; // setter 3
|
|||
}); |
|||
|
|||
var d = { |
|||
'c': c, |
|||
}; |
|||
|
|||
function testGetter1_1() { |
|||
expected_function_name = 'getter1'; |
|||
expected_source_line_text = ' return this.name; // getter 1'; |
|||
debugger; |
|||
var x = c.getter1; |
|||
} |
|||
|
|||
function testGetter1_2() { |
|||
expected_function_name = 'getter1'; |
|||
expected_source_line_text = ' return this.name; // getter 1'; |
|||
debugger; |
|||
var x = c['getter1']; |
|||
} |
|||
|
|||
function testGetter1_3() { |
|||
expected_function_name = 'getter1'; |
|||
expected_source_line_text = ' return this.name; // getter 1'; |
|||
debugger; |
|||
for (var i = 1; i < 2; i++) { |
|||
var x = c['getter' + i]; |
|||
} |
|||
} |
|||
|
|||
function testGetter1_4() { |
|||
expected_function_name = 'getter1'; |
|||
expected_source_line_text = ' return this.name; // getter 1'; |
|||
debugger; |
|||
var x = d.c.getter1; |
|||
} |
|||
|
|||
function testGetter1_5() { |
|||
expected_function_name = 'getter1'; |
|||
expected_source_line_text = ' return this.name; // getter 1'; |
|||
for (var i = 2; i != 1; i--); |
|||
debugger; |
|||
var x = d.c['getter' + i]; |
|||
} |
|||
|
|||
function testGetter2_1() { |
|||
expected_function_name = 'getter2'; |
|||
expected_source_line_text = ' return { // getter 2'; |
|||
for (var i = 2; i != 1; i--); |
|||
debugger; |
|||
var t = d.c.getter2.name; |
|||
} |
|||
|
|||
|
|||
function testGetterY_1() { |
|||
expected_function_name = 'getterY'; |
|||
expected_source_line_text = ' return this.name; // getter y'; |
|||
debugger; |
|||
var t = d.c.y; |
|||
} |
|||
|
|||
function testIndexedGetter3_1() { |
|||
expected_function_name = 'getter3'; |
|||
expected_source_line_text = ' return this.name; // getter 3'; |
|||
debugger; |
|||
var r = d.c[3]; |
|||
} |
|||
|
|||
function testSetterY_1() { |
|||
expected_function_name = 'setterY'; |
|||
expected_source_line_text = ' this.name = n; // setter y'; |
|||
debugger; |
|||
d.c.y = 'www'; |
|||
} |
|||
|
|||
function testIndexedSetter3_1() { |
|||
expected_function_name = 'setter3'; |
|||
expected_source_line_text = ' this.name = n; // setter 3'; |
|||
var i = 3 |
|||
debugger; |
|||
d.c[3] = 'www'; |
|||
} |
|||
|
|||
function testSetter1_1() { |
|||
expected_function_name = 'setter1'; |
|||
expected_source_line_text = ' this.name = n; // setter 1'; |
|||
debugger; |
|||
d.c.setter1 = 'aa'; |
|||
} |
|||
|
|||
function testSetter1_2() { |
|||
expected_function_name = 'setter1'; |
|||
expected_source_line_text = ' this.name = n; // setter 1'; |
|||
debugger; |
|||
d.c['setter1'] = 'bb'; |
|||
} |
|||
|
|||
function testSetter1_3() { |
|||
expected_function_name = 'setter1'; |
|||
expected_source_line_text = ' this.name = n; // setter 1'; |
|||
for (var i = 2; i != 1; i--); |
|||
debugger; |
|||
d.c['setter' + i] = i; |
|||
} |
|||
|
|||
var e = { |
|||
name: 'e' |
|||
}; |
|||
e.__proto__ = c; |
|||
|
|||
function testProtoGetter1_1() { |
|||
expected_function_name = 'getter1'; |
|||
expected_source_line_text = ' return this.name; // getter 1'; |
|||
debugger; |
|||
var x = e.getter1; |
|||
} |
|||
|
|||
function testProtoSetter1_1() { |
|||
expected_function_name = 'setter1'; |
|||
expected_source_line_text = ' this.name = n; // setter 1'; |
|||
debugger; |
|||
e.setter1 = 'aa'; |
|||
} |
|||
|
|||
function testProtoIndexedGetter3_1() { |
|||
expected_function_name = 'getter3'; |
|||
expected_source_line_text = ' return this.name; // getter 3'; |
|||
debugger; |
|||
var x = e[3]; |
|||
} |
|||
|
|||
function testProtoIndexedSetter3_1() { |
|||
expected_function_name = 'setter3'; |
|||
expected_source_line_text = ' this.name = n; // setter 3'; |
|||
debugger; |
|||
e[3] = 'new val'; |
|||
} |
|||
|
|||
function testProtoSetter1_2() { |
|||
expected_function_name = 'setter1'; |
|||
expected_source_line_text = ' this.name = n; // setter 1'; |
|||
for (var i = 2; i != 1; i--); |
|||
debugger; |
|||
e['setter' + i] = 'aa'; |
|||
} |
|||
|
|||
for (var n in this) { |
|||
if (n.substr(0, 4) != 'test') { |
|||
continue; |
|||
} |
|||
state = 1; |
|||
this[n](); |
|||
assertNull(exception); |
|||
assertEquals(3, state); |
|||
} |
|||
|
|||
// Get rid of the debug event listener.
|
|||
Debug.setListener(null); |
@ -0,0 +1,78 @@ |
|||
// Copyright 2009 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:
|
|||
//
|
|||
// * Redistributions of source code must retain the above copyright
|
|||
// notice, this list of conditions and the following disclaimer.
|
|||
// * Redistributions in binary form must reproduce the above
|
|||
// copyright notice, this list of conditions and the following
|
|||
// disclaimer in the documentation and/or other materials provided
|
|||
// with the distribution.
|
|||
// * Neither the name of Google Inc. nor the names of its
|
|||
// contributors may be used to endorse or promote products derived
|
|||
// from this software without specific prior written permission.
|
|||
//
|
|||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
// (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
|
|||
|
|||
// Get the Debug object exposed from the debug context global object.
|
|||
Debug = debug.Debug |
|||
|
|||
var exception = null; |
|||
var state = 1; |
|||
var expected_source_line_text = null; |
|||
var expected_function_name = null; |
|||
|
|||
// Simple debug event handler which first time will cause 'step in' action
|
|||
// and than check that execution is paused inside function
|
|||
// expected_function_name.
|
|||
function listener(event, exec_state, event_data, data) { |
|||
try { |
|||
if (event == Debug.DebugEvent.Break) { |
|||
if (state == 1) { |
|||
exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
|||
state = 2; |
|||
} else if (state == 2) { |
|||
assertEquals(expected_function_name, event_data.func().name()); |
|||
assertEquals(expected_source_line_text, |
|||
event_data.sourceLineText()); |
|||
state = 3; |
|||
} |
|||
} |
|||
} catch(e) { |
|||
exception = e; |
|||
} |
|||
}; |
|||
|
|||
// Add the debug event listener.
|
|||
Debug.setListener(listener); |
|||
|
|||
var a = [1,2,3,4,5]; |
|||
|
|||
// Test step into function call from a function without local variables.
|
|||
function testStepInArraySlice() { |
|||
expected_function_name = 'testStepInArraySlice'; |
|||
expected_source_line_text = '} // expected line'; |
|||
debugger; |
|||
var s = Array.prototype.slice.call(a, 2,3); |
|||
} // expected line
|
|||
|
|||
state = 1; |
|||
testStepInArraySlice(); |
|||
assertNull(exception); |
|||
assertEquals(3, state); |
|||
|
|||
// Get rid of the debug event listener.
|
|||
Debug.setListener(null); |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue