summaryrefslogtreecommitdiff
path: root/deps/v8/src/debug/mirrors.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/debug/mirrors.js')
-rw-r--r--deps/v8/src/debug/mirrors.js96
1 files changed, 57 insertions, 39 deletions
diff --git a/deps/v8/src/debug/mirrors.js b/deps/v8/src/debug/mirrors.js
index 11f9e485c1..5ff3e34955 100644
--- a/deps/v8/src/debug/mirrors.js
+++ b/deps/v8/src/debug/mirrors.js
@@ -8,22 +8,30 @@
// ----------------------------------------------------------------------------
// Imports
+var ErrorToString;
var FunctionSourceString;
var GlobalArray = global.Array;
var IsNaN = global.isNaN;
var JSONStringify = global.JSON.stringify;
+var MakeError;
+var MapEntries;
+var MapIteratorNext;
var MathMin = global.Math.min;
var promiseStatusSymbol = utils.ImportNow("promise_status_symbol");
var promiseValueSymbol = utils.ImportNow("promise_value_symbol");
+var SetIteratorNext;
+var SetValues;
var SymbolToString;
-var ToBoolean;
-var ToString;
utils.Import(function(from) {
+ ErrorToString = from.ErrorToString;
FunctionSourceString = from.FunctionSourceString;
+ MakeError = from.MakeError;
+ MapEntries = from.MapEntries;
+ MapIteratorNext = from.MapIteratorNext;
+ SetIteratorNext = from.SetIteratorNext;
+ SetValues = from.SetValues;
SymbolToString = from.SymbolToString;
- ToBoolean = from.ToBoolean;
- ToString = from.ToString;
});
// ----------------------------------------------------------------------------
@@ -536,7 +544,7 @@ Mirror.prototype.toText = function() {
* @extends Mirror
*/
function ValueMirror(type, value, transient) {
- %_CallFunction(this, type, Mirror);
+ %_Call(Mirror, this, type);
this.value_ = value;
if (!transient) {
this.allocateHandle_();
@@ -582,7 +590,7 @@ ValueMirror.prototype.value = function() {
* @extends ValueMirror
*/
function UndefinedMirror() {
- %_CallFunction(this, MirrorType.UNDEFINED_TYPE, UNDEFINED, ValueMirror);
+ %_Call(ValueMirror, this, MirrorType.UNDEFINED_TYPE, UNDEFINED);
}
inherits(UndefinedMirror, ValueMirror);
@@ -598,7 +606,7 @@ UndefinedMirror.prototype.toText = function() {
* @extends ValueMirror
*/
function NullMirror() {
- %_CallFunction(this, MirrorType.NULL_TYPE, null, ValueMirror);
+ %_Call(ValueMirror, this, MirrorType.NULL_TYPE, null);
}
inherits(NullMirror, ValueMirror);
@@ -615,7 +623,7 @@ NullMirror.prototype.toText = function() {
* @extends ValueMirror
*/
function BooleanMirror(value) {
- %_CallFunction(this, MirrorType.BOOLEAN_TYPE, value, ValueMirror);
+ %_Call(ValueMirror, this, MirrorType.BOOLEAN_TYPE, value);
}
inherits(BooleanMirror, ValueMirror);
@@ -632,7 +640,7 @@ BooleanMirror.prototype.toText = function() {
* @extends ValueMirror
*/
function NumberMirror(value) {
- %_CallFunction(this, MirrorType.NUMBER_TYPE, value, ValueMirror);
+ %_Call(ValueMirror, this, MirrorType.NUMBER_TYPE, value);
}
inherits(NumberMirror, ValueMirror);
@@ -649,7 +657,7 @@ NumberMirror.prototype.toText = function() {
* @extends ValueMirror
*/
function StringMirror(value) {
- %_CallFunction(this, MirrorType.STRING_TYPE, value, ValueMirror);
+ %_Call(ValueMirror, this, MirrorType.STRING_TYPE, value);
}
inherits(StringMirror, ValueMirror);
@@ -678,7 +686,7 @@ StringMirror.prototype.toText = function() {
* @extends Mirror
*/
function SymbolMirror(value) {
- %_CallFunction(this, MirrorType.SYMBOL_TYPE, value, ValueMirror);
+ %_Call(ValueMirror, this, MirrorType.SYMBOL_TYPE, value);
}
inherits(SymbolMirror, ValueMirror);
@@ -689,7 +697,7 @@ SymbolMirror.prototype.description = function() {
SymbolMirror.prototype.toText = function() {
- return %_CallFunction(this.value_, SymbolToString);
+ return %_Call(SymbolToString, this.value_);
}
@@ -703,7 +711,7 @@ SymbolMirror.prototype.toText = function() {
*/
function ObjectMirror(value, type, transient) {
type = type || MirrorType.OBJECT_TYPE;
- %_CallFunction(this, type, value, transient, ValueMirror);
+ %_Call(ValueMirror, this, type, value, transient);
}
inherits(ObjectMirror, ValueMirror);
@@ -953,7 +961,7 @@ ObjectMirror.GetInternalProperties = function(value) {
* @extends ObjectMirror
*/
function FunctionMirror(value) {
- %_CallFunction(this, value, MirrorType.FUNCTION_TYPE, ObjectMirror);
+ %_Call(ObjectMirror, this, value, MirrorType.FUNCTION_TYPE);
this.resolved_ = true;
}
inherits(FunctionMirror, ObjectMirror);
@@ -1107,7 +1115,7 @@ FunctionMirror.prototype.toText = function() {
function UnresolvedFunctionMirror(value) {
// Construct this using the ValueMirror as an unresolved function is not a
// real object but just a string.
- %_CallFunction(this, MirrorType.FUNCTION_TYPE, value, ValueMirror);
+ %_Call(ValueMirror, this, MirrorType.FUNCTION_TYPE, value);
this.propertyCount_ = 0;
this.elementCount_ = 0;
this.resolved_ = false;
@@ -1157,7 +1165,7 @@ UnresolvedFunctionMirror.prototype.propertyNames = function(kind, limit) {
* @extends ObjectMirror
*/
function ArrayMirror(value) {
- %_CallFunction(this, value, ObjectMirror);
+ %_Call(ObjectMirror, this, value);
}
inherits(ArrayMirror, ObjectMirror);
@@ -1174,7 +1182,7 @@ ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index,
if (from_index > to_index) return new GlobalArray();
var values = new GlobalArray(to_index - from_index + 1);
for (var i = from_index; i <= to_index; i++) {
- var details = %DebugGetPropertyDetails(this.value_, ToString(i));
+ var details = %DebugGetPropertyDetails(this.value_, TO_STRING(i));
var value;
if (details) {
value = new PropertyMirror(this, i, details);
@@ -1194,7 +1202,7 @@ ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index,
* @extends ObjectMirror
*/
function DateMirror(value) {
- %_CallFunction(this, value, ObjectMirror);
+ %_Call(ObjectMirror, this, value);
}
inherits(DateMirror, ObjectMirror);
@@ -1212,7 +1220,7 @@ DateMirror.prototype.toText = function() {
* @extends ObjectMirror
*/
function RegExpMirror(value) {
- %_CallFunction(this, value, MirrorType.REGEXP_TYPE, ObjectMirror);
+ %_Call(ObjectMirror, this, value, MirrorType.REGEXP_TYPE);
}
inherits(RegExpMirror, ObjectMirror);
@@ -1284,7 +1292,7 @@ RegExpMirror.prototype.toText = function() {
* @extends ObjectMirror
*/
function ErrorMirror(value) {
- %_CallFunction(this, value, MirrorType.ERROR_TYPE, ObjectMirror);
+ %_Call(ObjectMirror, this, value, MirrorType.ERROR_TYPE);
}
inherits(ErrorMirror, ObjectMirror);
@@ -1302,7 +1310,7 @@ ErrorMirror.prototype.toText = function() {
// Use the same text representation as in messages.js.
var text;
try {
- text = %_CallFunction(this.value_, builtins.$errorToString);
+ text = %_Call(ErrorToString, this.value_);
} catch (e) {
text = '#<Error>';
}
@@ -1317,7 +1325,7 @@ ErrorMirror.prototype.toText = function() {
* @extends ObjectMirror
*/
function PromiseMirror(value) {
- %_CallFunction(this, value, MirrorType.PROMISE_TYPE, ObjectMirror);
+ %_Call(ObjectMirror, this, value, MirrorType.PROMISE_TYPE);
}
inherits(PromiseMirror, ObjectMirror);
@@ -1346,7 +1354,7 @@ PromiseMirror.prototype.promiseValue = function() {
function MapMirror(value) {
- %_CallFunction(this, value, MirrorType.MAP_TYPE, ObjectMirror);
+ %_Call(ObjectMirror, this, value, MirrorType.MAP_TYPE);
}
inherits(MapMirror, ObjectMirror);
@@ -1372,7 +1380,7 @@ MapMirror.prototype.entries = function(opt_limit) {
return result;
}
- var iter = %_CallFunction(this.value_, builtins.$mapEntries);
+ var iter = %_Call(MapEntries, this.value_);
var next;
while ((!opt_limit || result.length < opt_limit) &&
!(next = iter.next()).done) {
@@ -1386,7 +1394,7 @@ MapMirror.prototype.entries = function(opt_limit) {
function SetMirror(value) {
- %_CallFunction(this, value, MirrorType.SET_TYPE, ObjectMirror);
+ %_Call(ObjectMirror, this, value, MirrorType.SET_TYPE);
}
inherits(SetMirror, ObjectMirror);
@@ -1395,7 +1403,7 @@ function IteratorGetValues_(iter, next_function, opt_limit) {
var result = [];
var next;
while ((!opt_limit || result.length < opt_limit) &&
- !(next = %_CallFunction(iter, next_function)).done) {
+ !(next = %_Call(next_function, iter)).done) {
result.push(next.value);
}
return result;
@@ -1414,13 +1422,13 @@ SetMirror.prototype.values = function(opt_limit) {
return %GetWeakSetValues(this.value_, opt_limit || 0);
}
- var iter = %_CallFunction(this.value_, builtins.$setValues);
- return IteratorGetValues_(iter, builtins.$setIteratorNext, opt_limit);
+ var iter = %_Call(SetValues, this.value_);
+ return IteratorGetValues_(iter, SetIteratorNext, opt_limit);
};
function IteratorMirror(value) {
- %_CallFunction(this, value, MirrorType.ITERATOR_TYPE, ObjectMirror);
+ %_Call(ObjectMirror, this, value, MirrorType.ITERATOR_TYPE);
}
inherits(IteratorMirror, ObjectMirror);
@@ -1435,11 +1443,11 @@ inherits(IteratorMirror, ObjectMirror);
IteratorMirror.prototype.preview = function(opt_limit) {
if (IS_MAP_ITERATOR(this.value_)) {
return IteratorGetValues_(%MapIteratorClone(this.value_),
- builtins.$mapIteratorNext,
+ MapIteratorNext,
opt_limit);
} else if (IS_SET_ITERATOR(this.value_)) {
return IteratorGetValues_(%SetIteratorClone(this.value_),
- builtins.$setIteratorNext,
+ SetIteratorNext,
opt_limit);
}
};
@@ -1452,7 +1460,7 @@ IteratorMirror.prototype.preview = function(opt_limit) {
* @extends Mirror
*/
function GeneratorMirror(value) {
- %_CallFunction(this, value, MirrorType.GENERATOR_TYPE, ObjectMirror);
+ %_Call(ObjectMirror, this, value, MirrorType.GENERATOR_TYPE);
}
inherits(GeneratorMirror, ObjectMirror);
@@ -1519,7 +1527,7 @@ GeneratorMirror.prototype.receiver = function() {
* @extends Mirror
*/
function PropertyMirror(mirror, name, details) {
- %_CallFunction(this, MirrorType.PROPERTY_TYPE, Mirror);
+ %_Call(Mirror, this, MirrorType.PROPERTY_TYPE);
this.mirror_ = mirror;
this.name_ = name;
this.value_ = details[0];
@@ -1662,7 +1670,7 @@ PropertyMirror.prototype.isNative = function() {
* @extends Mirror
*/
function InternalPropertyMirror(name, value) {
- %_CallFunction(this, MirrorType.INTERNAL_PROPERTY_TYPE, Mirror);
+ %_Call(Mirror, this, MirrorType.INTERNAL_PROPERTY_TYPE);
this.name_ = name;
this.value_ = value;
}
@@ -1875,7 +1883,7 @@ FrameDetails.prototype.stepInPositionsImpl = function() {
* @extends Mirror
*/
function FrameMirror(break_id, index) {
- %_CallFunction(this, MirrorType.FRAME_TYPE, Mirror);
+ %_Call(Mirror, this, MirrorType.FRAME_TYPE);
this.break_id_ = break_id;
this.index_ = index;
this.details_ = new FrameDetails(break_id, index);
@@ -2074,7 +2082,7 @@ FrameMirror.prototype.evaluate = function(source, disable_break,
this.details_.frameId(),
this.details_.inlinedFrameIndex(),
source,
- ToBoolean(disable_break),
+ TO_BOOLEAN(disable_break),
opt_context_object));
};
@@ -2233,8 +2241,10 @@ FrameMirror.prototype.toText = function(opt_locals) {
};
+// This indexes correspond definitions in debug-scopes.h.
var kScopeDetailsTypeIndex = 0;
var kScopeDetailsObjectIndex = 1;
+var kScopeDetailsNameIndex = 2;
function ScopeDetails(frame, fun, index, opt_details) {
if (frame) {
@@ -2271,6 +2281,14 @@ ScopeDetails.prototype.object = function() {
};
+ScopeDetails.prototype.name = function() {
+ if (!IS_UNDEFINED(this.break_id_)) {
+ %CheckExecutionState(this.break_id_);
+ }
+ return this.details_[kScopeDetailsNameIndex];
+};
+
+
ScopeDetails.prototype.setVariableValueImpl = function(name, new_value) {
var raw_res;
if (!IS_UNDEFINED(this.break_id_)) {
@@ -2296,7 +2314,7 @@ ScopeDetails.prototype.setVariableValueImpl = function(name, new_value) {
* @extends Mirror
*/
function ScopeMirror(frame, fun, index, opt_details) {
- %_CallFunction(this, MirrorType.SCOPE_TYPE, Mirror);
+ %_Call(Mirror, this, MirrorType.SCOPE_TYPE);
if (frame) {
this.frame_index_ = frame.index_;
} else {
@@ -2351,7 +2369,7 @@ ScopeMirror.prototype.setVariableValue = function(name, new_value) {
* @extends Mirror
*/
function ScriptMirror(script) {
- %_CallFunction(this, MirrorType.SCRIPT_TYPE, Mirror);
+ %_Call(Mirror, this, MirrorType.SCRIPT_TYPE);
this.script_ = script;
this.context_ = new ContextMirror(script.context_data);
this.allocateHandle_();
@@ -2472,7 +2490,7 @@ ScriptMirror.prototype.toText = function() {
* @extends Mirror
*/
function ContextMirror(data) {
- %_CallFunction(this, MirrorType.CONTEXT_TYPE, Mirror);
+ %_Call(Mirror, this, MirrorType.CONTEXT_TYPE);
this.data_ = data;
this.allocateHandle_();
}