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

Unified Diff: src/js/messages.js

Issue 2174723002: Move CallSite.toString to C++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@callsite-port
Patch Set: Rebase Created 4 years, 5 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/builtins/builtins-callsite.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/messages.js
diff --git a/src/js/messages.js b/src/js/messages.js
index 659de9b1a73613fc14c284372f4130d3928d8c22..ef1efe0e30e93873235b53833a4bbff56aa82dcc 100644
--- a/src/js/messages.js
+++ b/src/js/messages.js
@@ -16,20 +16,6 @@ var Bool16x8ToString;
var Bool32x4ToString;
var Bool8x16ToString;
var CallSite = utils.ImportNow("CallSite");
-var callSiteConstructorSymbol =
- utils.ImportNow("call_site_constructor_symbol");
-var callSiteReceiverSymbol =
- utils.ImportNow("call_site_receiver_symbol");
-var callSiteFunctionSymbol =
- utils.ImportNow("call_site_function_symbol");
-var callSitePositionSymbol =
- utils.ImportNow("call_site_position_symbol");
-var callSiteStrictSymbol =
- utils.ImportNow("call_site_strict_symbol");
-var callSiteWasmObjectSymbol =
- utils.ImportNow("call_site_wasm_obj_symbol");
-var callSiteWasmFunctionIndexSymbol =
- utils.ImportNow("call_site_wasm_func_index_symbol");
var Float32x4ToString;
var GlobalObject = global.Object;
var GlobalError = global.Error;
@@ -48,7 +34,6 @@ var ObjectHasOwnProperty;
var ObjectToString = utils.ImportNow("object_to_string");
var Script = utils.ImportNow("Script");
var stackTraceSymbol = utils.ImportNow("stack_trace_symbol");
-var StringIndexOf;
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
var Uint16x8ToString;
var Uint32x4ToString;
@@ -64,7 +49,6 @@ utils.Import(function(from) {
Int32x4ToString = from.Int32x4ToString;
Int8x16ToString = from.Int8x16ToString;
ObjectHasOwnProperty = from.ObjectHasOwnProperty;
- StringIndexOf = from.StringIndexOf;
Uint16x8ToString = from.Uint16x8ToString;
Uint32x4ToString = from.Uint32x4ToString;
Uint8x16ToString = from.Uint8x16ToString;
@@ -272,83 +256,6 @@ function GetStackTraceLine(recv, fun, pos, isGlobal) {
// ----------------------------------------------------------------------------
// Error implementation
-function CallSiteToString() {
- if (HAS_PRIVATE(this, callSiteWasmObjectSymbol)) {
- var funName = this.getFunctionName();
- var funcIndex = GET_PRIVATE(this, callSiteWasmFunctionIndexSymbol);
- var pos = this.getPosition();
- if (IS_NULL(funName)) funName = "<WASM UNNAMED>";
- return funName + " (<WASM>[" + funcIndex + "]+" + pos + ")";
- }
-
- var fileName;
- var fileLocation = "";
- if (this.isNative()) {
- fileLocation = "native";
- } else {
- fileName = this.getScriptNameOrSourceURL();
- if (!fileName && this.isEval()) {
- fileLocation = this.getEvalOrigin();
- fileLocation += ", "; // Expecting source position to follow.
- }
-
- if (fileName) {
- fileLocation += fileName;
- } else {
- // Source code does not originate from a file and is not native, but we
- // can still get the source position inside the source string, e.g. in
- // an eval string.
- fileLocation += "<anonymous>";
- }
- var lineNumber = this.getLineNumber();
- if (lineNumber != null) {
- fileLocation += ":" + lineNumber;
- var columnNumber = this.getColumnNumber();
- if (columnNumber) {
- fileLocation += ":" + columnNumber;
- }
- }
- }
-
- var line = "";
- var functionName = this.getFunctionName();
- var addSuffix = true;
- var isConstructor = this.isConstructor();
- var isMethodCall = !(this.isToplevel() || isConstructor);
- if (isMethodCall) {
- var typeName = GetTypeName(GET_PRIVATE(this, callSiteReceiverSymbol), true);
- var methodName = this.getMethodName();
- if (functionName) {
- if (typeName && %_Call(StringIndexOf, functionName, typeName) != 0) {
- line += typeName + ".";
- }
- line += functionName;
- if (methodName &&
- (%_Call(StringIndexOf, functionName, "." + methodName) !=
- functionName.length - methodName.length - 1)) {
- line += " [as " + methodName + "]";
- }
- } else {
- line += typeName + "." + (methodName || "<anonymous>");
- }
- } else if (isConstructor) {
- line += "new " + (functionName || "<anonymous>");
- } else if (functionName) {
- line += functionName;
- } else {
- line += fileLocation;
- addSuffix = false;
- }
- if (addSuffix) {
- line += " (" + fileLocation + ")";
- }
- return line;
-}
-
-%AddNamedProperty(CallSite.prototype, "toString", CallSiteToString,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
-%SetNativeFlag(CallSiteToString);
-
function FormatErrorString(error) {
try {
« no previous file with comments | « src/builtins/builtins-callsite.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698