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

Side by Side Diff: src/messages.js

Issue 1144163002: Revert of Use shared container to manage imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/math.js ('k') | src/object-observe.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // ------------------------------------------------------------------- 5 // -------------------------------------------------------------------
6 6
7 var $errorToString; 7 var $errorToString;
8 var $getStackTraceLine; 8 var $getStackTraceLine;
9 var $messageGetPositionInLine; 9 var $messageGetPositionInLine;
10 var $messageGetLineNumber; 10 var $messageGetLineNumber;
(...skipping 13 matching lines...) Expand all
24 var MakeEvalError; 24 var MakeEvalError;
25 var MakeRangeError; 25 var MakeRangeError;
26 var MakeReferenceError; 26 var MakeReferenceError;
27 var MakeSyntaxError; 27 var MakeSyntaxError;
28 var MakeTypeError; 28 var MakeTypeError;
29 var MakeURIError; 29 var MakeURIError;
30 var MakeReferenceErrorEmbedded; 30 var MakeReferenceErrorEmbedded;
31 var MakeSyntaxErrorEmbedded; 31 var MakeSyntaxErrorEmbedded;
32 var MakeTypeErrorEmbedded; 32 var MakeTypeErrorEmbedded;
33 33
34 (function(global, utils) { 34 (function(global, shared, exports) {
35 35
36 %CheckIsBootstrapping(); 36 %CheckIsBootstrapping();
37 37
38 // ------------------------------------------------------------------- 38 // -------------------------------------------------------------------
39 // Imports 39 // Imports
40 40
41 var GlobalObject = global.Object; 41 var GlobalObject = global.Object;
42 var InternalArray = utils.InternalArray; 42 var InternalArray = shared.InternalArray;
43
44 var StringCharAt;
45 var StringIndexOf;
46 var StringSubstring;
47
48 utils.Import(function(from) {
49 StringCharAt = from.StringCharAt;
50 StringIndexOf = from.StringIndexOf;
51 StringSubstring = from.StringSubstring;
52 });
53 43
54 // ------------------------------------------------------------------- 44 // -------------------------------------------------------------------
55 45
56 var GlobalError; 46 var GlobalError;
57 var GlobalTypeError; 47 var GlobalTypeError;
58 var GlobalRangeError; 48 var GlobalRangeError;
59 var GlobalURIError; 49 var GlobalURIError;
60 var GlobalSyntaxError; 50 var GlobalSyntaxError;
61 var GlobalReferenceError; 51 var GlobalReferenceError;
62 var GlobalEvalError; 52 var GlobalEvalError;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 */ 238 */
249 function ScriptLocationFromPosition(position, 239 function ScriptLocationFromPosition(position,
250 include_resource_offset) { 240 include_resource_offset) {
251 var line = this.lineFromPosition(position); 241 var line = this.lineFromPosition(position);
252 if (line == -1) return null; 242 if (line == -1) return null;
253 243
254 // Determine start, end and column. 244 // Determine start, end and column.
255 var line_ends = this.line_ends; 245 var line_ends = this.line_ends;
256 var start = line == 0 ? 0 : line_ends[line - 1] + 1; 246 var start = line == 0 ? 0 : line_ends[line - 1] + 1;
257 var end = line_ends[line]; 247 var end = line_ends[line];
258 if (end > 0 && %_CallFunction(this.source, end - 1, StringCharAt) == '\r') { 248 if (end > 0 && %_CallFunction(this.source, end - 1, $stringCharAt) == '\r') {
259 end--; 249 end--;
260 } 250 }
261 var column = position - start; 251 var column = position - start;
262 252
263 // Adjust according to the offset within the resource. 253 // Adjust according to the offset within the resource.
264 if (include_resource_offset) { 254 if (include_resource_offset) {
265 line += this.line_offset; 255 line += this.line_offset;
266 if (line == this.line_offset) { 256 if (line == this.line_offset) {
267 column += this.column_offset; 257 column += this.column_offset;
268 } 258 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 361
372 // Check parameter. 362 // Check parameter.
373 if (line < 0 || this.lineCount() <= line) { 363 if (line < 0 || this.lineCount() <= line) {
374 return null; 364 return null;
375 } 365 }
376 366
377 // Return the source line. 367 // Return the source line.
378 var line_ends = this.line_ends; 368 var line_ends = this.line_ends;
379 var start = line == 0 ? 0 : line_ends[line - 1] + 1; 369 var start = line == 0 ? 0 : line_ends[line - 1] + 1;
380 var end = line_ends[line]; 370 var end = line_ends[line];
381 return %_CallFunction(this.source, start, end, StringSubstring); 371 return %_CallFunction(this.source, start, end, $stringSubstring);
382 } 372 }
383 373
384 374
385 /** 375 /**
386 * Returns the number of source lines. 376 * Returns the number of source lines.
387 * @return {number} 377 * @return {number}
388 * Number of source lines. 378 * Number of source lines.
389 */ 379 */
390 function ScriptLineCount() { 380 function ScriptLineCount() {
391 // Return number of source lines. 381 // Return number of source lines.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 452
463 /** 453 /**
464 * Get the source text for a SourceLocation 454 * Get the source text for a SourceLocation
465 * @return {String} 455 * @return {String}
466 * Source text for this location. 456 * Source text for this location.
467 */ 457 */
468 function SourceLocationSourceText() { 458 function SourceLocationSourceText() {
469 return %_CallFunction(this.script.source, 459 return %_CallFunction(this.script.source,
470 this.start, 460 this.start,
471 this.end, 461 this.end,
472 StringSubstring); 462 $stringSubstring);
473 } 463 }
474 464
475 465
476 $setUpLockedPrototype(SourceLocation, 466 $setUpLockedPrototype(SourceLocation,
477 ["script", "position", "line", "column", "start", "end"], 467 ["script", "position", "line", "column", "start", "end"],
478 ["sourceText", SourceLocationSourceText] 468 ["sourceText", SourceLocationSourceText]
479 ); 469 );
480 470
481 471
482 /** 472 /**
(...skipping 24 matching lines...) Expand all
507 497
508 /** 498 /**
509 * Get the source text for a SourceSlice 499 * Get the source text for a SourceSlice
510 * @return {String} Source text for this slice. The last line will include 500 * @return {String} Source text for this slice. The last line will include
511 * the line terminating characters (if any) 501 * the line terminating characters (if any)
512 */ 502 */
513 function SourceSliceSourceText() { 503 function SourceSliceSourceText() {
514 return %_CallFunction(this.script.source, 504 return %_CallFunction(this.script.source,
515 this.from_position, 505 this.from_position,
516 this.to_position, 506 this.to_position,
517 StringSubstring); 507 $stringSubstring);
518 } 508 }
519 509
520 $setUpLockedPrototype(SourceSlice, 510 $setUpLockedPrototype(SourceSlice,
521 ["script", "from_line", "to_line", "from_position", "to_position"], 511 ["script", "from_line", "to_line", "from_position", "to_position"],
522 ["sourceText", SourceSliceSourceText] 512 ["sourceText", SourceSliceSourceText]
523 ); 513 );
524 514
525 515
526 // Returns the offset of the given position within the containing 516 // Returns the offset of the given position within the containing
527 // line. 517 // line.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 var line = ""; 672 var line = "";
683 var functionName = this.getFunctionName(); 673 var functionName = this.getFunctionName();
684 var addSuffix = true; 674 var addSuffix = true;
685 var isConstructor = this.isConstructor(); 675 var isConstructor = this.isConstructor();
686 var isMethodCall = !(this.isToplevel() || isConstructor); 676 var isMethodCall = !(this.isToplevel() || isConstructor);
687 if (isMethodCall) { 677 if (isMethodCall) {
688 var typeName = GetTypeName(GET_PRIVATE(this, CallSiteReceiverKey), true); 678 var typeName = GetTypeName(GET_PRIVATE(this, CallSiteReceiverKey), true);
689 var methodName = this.getMethodName(); 679 var methodName = this.getMethodName();
690 if (functionName) { 680 if (functionName) {
691 if (typeName && 681 if (typeName &&
692 %_CallFunction(functionName, typeName, StringIndexOf) != 0) { 682 %_CallFunction(functionName, typeName, $stringIndexOf) != 0) {
693 line += typeName + "."; 683 line += typeName + ".";
694 } 684 }
695 line += functionName; 685 line += functionName;
696 if (methodName && 686 if (methodName &&
697 (%_CallFunction(functionName, "." + methodName, StringIndexOf) != 687 (%_CallFunction(functionName, "." + methodName, $stringIndexOf) !=
698 functionName.length - methodName.length - 1)) { 688 functionName.length - methodName.length - 1)) {
699 line += " [as " + methodName + "]"; 689 line += " [as " + methodName + "]";
700 } 690 }
701 } else { 691 } else {
702 line += typeName + "." + (methodName || "<anonymous>"); 692 line += typeName + "." + (methodName || "<anonymous>");
703 } 693 }
704 } else if (isConstructor) { 694 } else if (isConstructor) {
705 line += "new " + (functionName || "<anonymous>"); 695 line += "new " + (functionName || "<anonymous>");
706 } else if (functionName) { 696 } else if (functionName) {
707 line += functionName; 697 line += functionName;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 return MakeGenericError(GlobalURIError, kURIMalformed); 1067 return MakeGenericError(GlobalURIError, kURIMalformed);
1078 } 1068 }
1079 1069
1080 //Boilerplate for exceptions for stack overflows. Used from 1070 //Boilerplate for exceptions for stack overflows. Used from
1081 //Isolate::StackOverflow(). 1071 //Isolate::StackOverflow().
1082 $stackOverflowBoilerplate = MakeRangeError(kStackOverflow); 1072 $stackOverflowBoilerplate = MakeRangeError(kStackOverflow);
1083 %DefineAccessorPropertyUnchecked($stackOverflowBoilerplate, 'stack', 1073 %DefineAccessorPropertyUnchecked($stackOverflowBoilerplate, 'stack',
1084 StackTraceGetter, StackTraceSetter, DONT_ENUM); 1074 StackTraceGetter, StackTraceSetter, DONT_ENUM);
1085 1075
1086 }) 1076 })
OLDNEW
« no previous file with comments | « src/math.js ('k') | src/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698