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

Unified Diff: src/messages.js

Issue 11971015: Skip stack trace formatting in case the global object is already dead. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix leaks in the setter. Created 7 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/json-stringifier.h ('k') | src/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 4a8143e611162a447436ecb64aefb670e10c14fb..d07b54fda48ea249e5db8e437384f5a14e4e451a 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -826,10 +826,12 @@ function CallSiteGetMethodName() {
return ownName;
}
var name = null;
- for (var prop in this.receiver) {
+ var property_names = %GetPropertyNamesNoSideEffect(this.receiver);
+ for (var i = 0; i < property_names.length; i++) {
+ var prop = property_names[i];
if (%_CallFunction(this.receiver, prop, ObjectLookupGetter) === this.fun ||
%_CallFunction(this.receiver, prop, ObjectLookupSetter) === this.fun ||
- %GetDataProperty(this.receiver, prop) === this.fun) {
+ %GetDataProperty(this.receiver, TO_STRING_INLINE(prop)) === this.fun) {
// If we find more than one match bail out to avoid confusion.
if (name) {
return null;
@@ -1130,6 +1132,8 @@ function captureStackTrace(obj, cons_opt) {
// The 'stack' property of the receiver is set as data property. If
// the receiver is the same as holder, this accessor pair is replaced.
var setter = function(v) {
+ // If the receiver is the holder, release the raw stack trace.
+ if (this == obj) stack = void 0;
%DefineOrRedefineDataProperty(this, 'stack', v, NONE);
};
@@ -1282,11 +1286,11 @@ function SetUpStackOverflowBoilerplate() {
holder = %GetPrototype(holder);
if (holder == null) return MakeSyntaxError('illegal_access', []);
}
- var stack = %GetOverflowedStackTrace(holder);
+ var stack = %GetOverflowStackTrace(holder);
if (IS_STRING(stack)) return stack;
if (IS_ARRAY(stack)) {
var result = FormatStackTrace(error_string, GetStackFrames(stack));
- %SetOverflowedStackTrace(holder, result);
+ %SetOverflowStackTrace(holder, result);
return result;
}
return void 0;
@@ -1296,9 +1300,9 @@ function SetUpStackOverflowBoilerplate() {
// The 'stack' property of the receiver is set as data property. If
// the receiver is the same as holder, this accessor pair is replaced.
function setter(v) {
+ // Attempt to release the overflow stack trace stored as hidden property.
+ if (IS_ERROR(this)) %SetOverflowStackTrace(this, void 0);
%DefineOrRedefineDataProperty(this, 'stack', v, NONE);
- // Release the stack trace that is stored as hidden property, if exists.
- %SetOverflowedStackTrace(this, void 0);
}
%DefineOrRedefineAccessorProperty(
« no previous file with comments | « src/json-stringifier.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698