⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mirror-delay.js.svn-base

📁 Google浏览器V8内核代码
💻 SVN-BASE
📖 第 1 页 / 共 4 页
字号:
ArrayMirror.prototype.length = function() {  return this.value_.length;};ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, opt_to_index) {  var from_index = opt_from_index || 0;  var to_index = opt_to_index || this.length() - 1;  if (from_index > to_index) return new Array();  var values = new Array(to_index - from_index + 1);  for (var i = from_index; i <= to_index; i++) {    var details = %DebugGetLocalPropertyDetails(this.value_, %ToString(i));    var value;    if (details) {      value = new PropertyMirror(this, i, details[0], details[1]);    } else {      value = new UndefinedMirror();    }    values[i - from_index] = value;  }  return values;}ArrayMirror.prototype.fillJSON_ = function(content, details) {  // Fill JSON as for parent (ObjectMirror) but just with named properties.  ArrayMirror.super_.fillJSON_.call(this, content, details, PropertyKind.Named);  // Fill indexed properties seperately.  if (details) {    this.fillJSONProperties_(content, PropertyKind.Indexed, 'indexedProperties')  }  // Add the array length.  content.push(MakeJSONPair_('length', NumberToJSON_(this.length())));}/** * Mirror object for dates. * @param {Date} value The Date object reflected by this mirror * @constructor * @extends ObjectMirror */function DateMirror(value) {  ObjectMirror.call(this, value);};inherits(DateMirror, ObjectMirror);DateMirror.prototype.fillJSON_ = function(content, details) {  // Fill JSON properties from parent (ObjectMirror).  DateMirror.super_.fillJSON_.call(this, content, details);  // Add date specific properties.  content.push(MakeJSONPair_('value', DateToJSON_(this.value_)));}DateMirror.prototype.toText = function() {  return DateToISO8601_(this.value_);}/** * Mirror object for regular expressions. * @param {RegExp} value The RegExp object reflected by this mirror * @constructor * @extends ObjectMirror */function RegExpMirror(value) {  ObjectMirror.call(this, value, REGEXP_TYPE);};inherits(RegExpMirror, ObjectMirror);/** * Returns the source to the regular expression. * @return {string or undefined} The source to the regular expression */RegExpMirror.prototype.source = function() {  return this.value_.source;};/** * Returns whether this regular expression has the global (g) flag set. * @return {boolean} Value of the global flag */RegExpMirror.prototype.global = function() {  return this.value_.global;};/** * Returns whether this regular expression has the ignore case (i) flag set. * @return {boolean} Value of the ignore case flag */RegExpMirror.prototype.ignoreCase = function() {  return this.value_.ignoreCase;};/** * Returns whether this regular expression has the multiline (m) flag set. * @return {boolean} Value of the multiline flag */RegExpMirror.prototype.multiline = function() {  return this.value_.multiline;};RegExpMirror.prototype.fillJSON_ = function(content, details) {  // Fill JSON properties from parent (ObjectMirror).  RegExpMirror.super_.fillJSON_.call(this, content, details);  // Add regexp specific properties.  content.push(MakeJSONPair_('source', StringToJSON_(this.source())));  content.push(MakeJSONPair_('global', BooleanToJSON_(this.global())));  content.push(MakeJSONPair_('ignoreCase', BooleanToJSON_(this.ignoreCase())));  content.push(MakeJSONPair_('multiline', BooleanToJSON_(this.multiline())));}RegExpMirror.prototype.toText = function() {  // Simpel to text which is used when on specialization in subclass.  return "/" + this.source() + "/";}/** * Mirror object for error objects. * @param {Error} value The error object reflected by this mirror * @constructor * @extends ObjectMirror */function ErrorMirror(value) {  ObjectMirror.call(this, value, ERROR_TYPE);};inherits(ErrorMirror, ObjectMirror);/** * Returns the message for this eror object. * @return {string or undefined} The message for this eror object */ErrorMirror.prototype.message = function() {  return this.value_.message;};ErrorMirror.prototype.fillJSON_ = function(content, details) {  // Fill JSON properties from parent (ObjectMirror).  ErrorMirror.super_.fillJSON_.call(this, content, details);  // Add error specific properties.  content.push(MakeJSONPair_('message', StringToJSON_(this.message())));}ErrorMirror.prototype.toText = function() {  // Use the same text representation as in messages.js.  var text;  try {    str = builtins.ToDetailString(this.value_);  } catch (e) {    str = '#<an Error>';  }  return str;}/** * Base mirror object for properties. * @param {ObjectMirror} mirror The mirror object having this property * @param {string} name The name of the property * @param {Object} value The value of the property * @constructor * @extends Mirror */function PropertyMirror(mirror, name, value, details) {  Mirror.call(this, PROPERTY_TYPE);  this.mirror_ = mirror;  this.name_ = name;  this.value_ = value;  this.details_ = details;};inherits(PropertyMirror, Mirror);PropertyMirror.prototype.isReadOnly = function() {  return (this.attributes() & PropertyAttribute.ReadOnly) != 0;}PropertyMirror.prototype.isEnum = function() {  return (this.attributes() & PropertyAttribute.DontEnum) == 0;}PropertyMirror.prototype.canDelete = function() {  return (this.attributes() & PropertyAttribute.DontDelete) == 0;}PropertyMirror.prototype.name = function() {  return this.name_;}PropertyMirror.prototype.isIndexed = function() {  for (var i = 0; i < this.name_.length; i++) {    if (this.name_[i] < '0' || '9' < this.name_[i]) {      return false;    }  }  return true;}PropertyMirror.prototype.value = function() {  if (this.propertyType() == PropertyType.Callbacks) {    // TODO(1242933): AccessorMirror should have getter/setter values.    return new AccessorMirror();  } else if (this.type() == PropertyType.Interceptor) {    return new UndefinedMirror();  } else {    return MakeMirror(this.value_);  }}PropertyMirror.prototype.attributes = function() {  return %DebugPropertyAttributesFromDetails(this.details_);}PropertyMirror.prototype.propertyType = function() {  return %DebugPropertyTypeFromDetails(this.details_);}PropertyMirror.prototype.insertionIndex = function() {  return %DebugPropertyIndexFromDetails(this.details_);}PropertyMirror.prototype.fillJSON_ = function(content, details) {  content.push(MakeJSONPair_('name', StringToJSON_(this.name())));  content.push(MakeJSONPair_('value', this.value().toJSONProtocol(details)));  if (this.attributes() != PropertyAttribute.None) {    content.push(MakeJSONPair_('attributes', NumberToJSON_(this.attributes())));  }  if (this.propertyType() != PropertyType.Normal) {    content.push(MakeJSONPair_('propertyType', NumberToJSON_(this.propertyType())));  }}/** * Mirror object for interceptor named properties. * @param {ObjectMirror} mirror The mirror object having this property * @param {String} name The name of the property * @param {value} value The value of the property * @constructor * @extends PropertyMirror */function InterceptorPropertyMirror(mirror, name, value) {  PropertyMirror.call(this, mirror, name, value, PropertyType.Interceptor);};inherits(InterceptorPropertyMirror, PropertyMirror);/** * Mirror object for property accessors. * @param {Function} getter The getter function for this accessor * @param {Function} setter The setter function for this accessor * @constructor * @extends Mirror */function AccessorMirror(getter, setter) {  Mirror.call(this, ACCESSOR_TYPE);  this.getter_ = getter;  this.setter_ = setter;};inherits(AccessorMirror, Mirror);/** * Returns whether this accessor is native or not. A native accessor is either * a VM buildin or provided through the API. A non native accessor is defined * in JavaScript using the __defineGetter__ and/or __defineGetter__ functions. * @return {boolean} True is the accessor is native */AccessorMirror.prototype.isNative = function() {  return IS_UNDEFINED(this.getter_) && IS_UNDEFINED(this.setter_);}/** * Returns a mirror for the function of a non native getter. * @return {FunctionMirror} Function mirror for the getter set using *     __defineGetter__. */AccessorMirror.prototype.getter = function(details) {  return MakeMirror(this.getter_);}/** * Returns a mirror for the function of a non native setter. * @return {FunctionMirror} Function mirror for the getter set using *     __defineSetter__. */AccessorMirror.prototype.setter = function(details) {  return MakeMirror(this.setter_);}/** * Serialize the accessor mirror into JSON format. For accessor it has the * following format. *   {"type":"accessor",      "native:"<boolean>,      "getter":<function mirror JSON serialization>,      "setter":<function mirror JSON serialization>} * For specialized mirrors inheriting from the base Mirror * @param {boolean} details Indicate level of details to include * @return {string} JSON serialization */AccessorMirror.prototype.fillJSON_ = function(content, details) {  AccessorMirror.super_.fillJSONType_.call(this, content);  if (this.isNative()) {    content.push(MakeJSONPair_('native', BooleanToJSON_(true)));  } else {    content.push(MakeJSONPair_('getter', this.getter().toJSONProtocol(false)));    content.push(MakeJSONPair_('setter', this.setter().toJSONProtocol(false)));  }}const kFrameDetailsFrameIdIndex = 0;const kFrameDetailsReceiverIndex = 1;const kFrameDetailsFunctionIndex = 2;const kFrameDetailsArgumentCountIndex = 3;const kFrameDetailsLocalCountIndex = 4;const kFrameDetailsSourcePositionIndex = 5;const kFrameDetailsConstructCallIndex = 6;const kFrameDetailsDebuggerFrameIndex = 7;const kFrameDetailsFirstDynamicIndex = 8;const kFrameDetailsNameIndex = 0;const kFrameDetailsValueIndex = 1;const kFrameDetailsNameValueSize = 2;/** * Wrapper for the frame details information retreived from the VM. The frame * details from the VM is an array with the following content. See runtime.cc * Runtime_GetFrameDetails. *     0: Id *     1: Receiver *     2: Function *     3: Argument count *     4: Local count *     5: Source position *     6: Construct call *     Arguments name, value *     Locals name, value * @param {number} break_id Current break id * @param {number} index Frame number * @constructor */function FrameDetails(break_id, index) {  this.break_id_ = break_id;  this.details_ = %GetFrameDetails(break_id, index);};FrameDetails.prototype.frameId = function() {  %CheckExecutionState(this.break_id_);  return this.details_[kFrameDetailsFrameIdIndex];}FrameDetails.prototype.receiver = function() {  %CheckExecutionState(this.break_id_);  return this.details_[kFrameDetailsReceiverIndex];}FrameDetails.prototype.func = function() {  %CheckExecutionState(this.break_id_);  return this.details_[kFrameDetailsFunctionIndex];}FrameDetails.prototype.isConstructCall = function() {  %CheckExecutionState(this.break_id_);  return this.details_[kFrameDetailsConstructCallIndex];}FrameDetails.prototype.isDebuggerFrame = function() {  %CheckExecutionState(this.break_id_);  return this.details_[kFrameDetailsDebuggerFrameIndex];}FrameDetails.prototype.argumentCount = function() {  %CheckExecutionState(this.break_id_);  return this.details_[kFrameDetailsArgumentCountIndex];}FrameDetails.prototype.argumentName = function(index) {  %CheckExecutionState(this.break_id_);  if (index >= 0 && index < this.argumentCount()) {    return this.details_[kFrameDetailsFirstDynamicIndex +                         index * kFrameDetailsNameValueSize +                         kFrameDetailsNameIndex]  }}FrameDetails.prototype.argumentValue = function(index) {  %CheckExecutionState(this.break_id_);  if (index >= 0 && index < this.argumentCount()) {    return this.details_[kFrameDetailsFirstDynamicIndex +                         index * kFrameDetailsNameValueSize +                         kFrameDetailsValueIndex]  }}FrameDetails.prototype.localCount = function() {  %CheckExecutionState(this.break_id_);  return this.details_[kFrameDetailsLocalCountIndex];}FrameDetails.prototype.sourcePosition = function() {  %CheckExecutionState(this.break_id_);  return this.details_[kFrameDetailsSourcePositionIndex];}FrameDetails.prototype.localName = function(index) {  %CheckExecutionState(this.break_id_);  if (index >= 0 && index < this.localCount()) {    var locals_offset = kFrameDetailsFirstDynamicIndex + this.argumentCount() * kFrameDetailsNameValueSize    return this.details_[locals_offset +                         index * kFrameDetailsNameValueSize +                         kFrameDetailsNameIndex]  }}FrameDetails.prototype.localValue = function(index) {  %CheckExecutionState(this.break_id_);  if (index >= 0 && index < this.localCount()) {    var locals_offset = kFrameDetailsFirstDynamicIndex + this.argumentCount() * kFrameDetailsNameValueSize    return this.details_[locals_offset +                         index * kFrameDetailsNameValueSize +                         kFrameDetailsValueIndex]  }}/** * Mirror object for stack frames. * @param {number} break_id The break id in the VM for which this frame is       valid * @param {number} index The frame index (top frame is index 0) * @constructor * @extends Mirror */function FrameMirror(break_id, index) {  Mirror.call(this, FRAME_TYPE);  this.break_id_ = break_id;  this.index_ = index;  this.details_ = new FrameDetails(break_id, index);};inherits(FrameMirror, Mirror);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -