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

Side by Side Diff: src/messages.js

Issue 1143993003: Use shared container to manage imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed test for no-snap 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, shared, exports) { 34 (function(global, utils) {
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 = shared.InternalArray; 42 var InternalArray = utils.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 });
43 53
44 // ------------------------------------------------------------------- 54 // -------------------------------------------------------------------
45 55
46 var GlobalError; 56 var GlobalError;
47 var GlobalTypeError; 57 var GlobalTypeError;
48 var GlobalRangeError; 58 var GlobalRangeError;
49 var GlobalURIError; 59 var GlobalURIError;
50 var GlobalSyntaxError; 60 var GlobalSyntaxError;
51 var GlobalReferenceError; 61 var GlobalReferenceError;
52 var GlobalEvalError; 62 var GlobalEvalError;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 */ 248 */
239 function ScriptLocationFromPosition(position, 249 function ScriptLocationFromPosition(position,
240 include_resource_offset) { 250 include_resource_offset) {
241 var line = this.lineFromPosition(position); 251 var line = this.lineFromPosition(position);
242 if (line == -1) return null; 252 if (line == -1) return null;
243 253
244 // Determine start, end and column. 254 // Determine start, end and column.
245 var line_ends = this.line_ends; 255 var line_ends = this.line_ends;
246 var start = line == 0 ? 0 : line_ends[line - 1] + 1; 256 var start = line == 0 ? 0 : line_ends[line - 1] + 1;
247 var end = line_ends[line]; 257 var end = line_ends[line];
248 if (end > 0 && %_CallFunction(this.source, end - 1, $stringCharAt) == '\r') { 258 if (end > 0 && %_CallFunction(this.source, end - 1, StringCharAt) == '\r') {
249 end--; 259 end--;
250 } 260 }
251 var column = position - start; 261 var column = position - start;
252 262
253 // Adjust according to the offset within the resource. 263 // Adjust according to the offset within the resource.
254 if (include_resource_offset) { 264 if (include_resource_offset) {
255 line += this.line_offset; 265 line += this.line_offset;
256 if (line == this.line_offset) { 266 if (line == this.line_offset) {
257 column += this.column_offset; 267 column += this.column_offset;
258 } 268 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 371
362 // Check parameter. 372 // Check parameter.
363 if (line < 0 || this.lineCount() <= line) { 373 if (line < 0 || this.lineCount() <= line) {
364 return null; 374 return null;
365 } 375 }
366 376
367 // Return the source line. 377 // Return the source line.
368 var line_ends = this.line_ends; 378 var line_ends = this.line_ends;
369 var start = line == 0 ? 0 : line_ends[line - 1] + 1; 379 var start = line == 0 ? 0 : line_ends[line - 1] + 1;
370 var end = line_ends[line]; 380 var end = line_ends[line];
371 return %_CallFunction(this.source, start, end, $stringSubstring); 381 return %_CallFunction(this.source, start, end, StringSubstring);
372 } 382 }
373 383
374 384
375 /** 385 /**
376 * Returns the number of source lines. 386 * Returns the number of source lines.
377 * @return {number} 387 * @return {number}
378 * Number of source lines. 388 * Number of source lines.
379 */ 389 */
380 function ScriptLineCount() { 390 function ScriptLineCount() {
381 // Return number of source lines. 391 // Return number of source lines.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 462
453 /** 463 /**
454 * Get the source text for a SourceLocation 464 * Get the source text for a SourceLocation
455 * @return {String} 465 * @return {String}
456 * Source text for this location. 466 * Source text for this location.
457 */ 467 */
458 function SourceLocationSourceText() { 468 function SourceLocationSourceText() {
459 return %_CallFunction(this.script.source, 469 return %_CallFunction(this.script.source,
460 this.start, 470 this.start,
461 this.end, 471 this.end,
462 $stringSubstring); 472 StringSubstring);
463 } 473 }
464 474
465 475
466 $setUpLockedPrototype(SourceLocation, 476 $setUpLockedPrototype(SourceLocation,
467 ["script", "position", "line", "column", "start", "end"], 477 ["script", "position", "line", "column", "start", "end"],
468 ["sourceText", SourceLocationSourceText] 478 ["sourceText", SourceLocationSourceText]
469 ); 479 );
470 480
471 481
472 /** 482 /**
(...skipping 24 matching lines...) Expand all
497 507
498 /** 508 /**
499 * Get the source text for a SourceSlice 509 * Get the source text for a SourceSlice
500 * @return {String} Source text for this slice. The last line will include 510 * @return {String} Source text for this slice. The last line will include
501 * the line terminating characters (if any) 511 * the line terminating characters (if any)
502 */ 512 */
503 function SourceSliceSourceText() { 513 function SourceSliceSourceText() {
504 return %_CallFunction(this.script.source, 514 return %_CallFunction(this.script.source,
505 this.from_position, 515 this.from_position,
506 this.to_position, 516 this.to_position,
507 $stringSubstring); 517 StringSubstring);
508 } 518 }
509 519
510 $setUpLockedPrototype(SourceSlice, 520 $setUpLockedPrototype(SourceSlice,
511 ["script", "from_line", "to_line", "from_position", "to_position"], 521 ["script", "from_line", "to_line", "from_position", "to_position"],
512 ["sourceText", SourceSliceSourceText] 522 ["sourceText", SourceSliceSourceText]
513 ); 523 );
514 524
515 525
516 // Returns the offset of the given position within the containing 526 // Returns the offset of the given position within the containing
517 // line. 527 // line.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 var line = ""; 682 var line = "";
673 var functionName = this.getFunctionName(); 683 var functionName = this.getFunctionName();
674 var addSuffix = true; 684 var addSuffix = true;
675 var isConstructor = this.isConstructor(); 685 var isConstructor = this.isConstructor();
676 var isMethodCall = !(this.isToplevel() || isConstructor); 686 var isMethodCall = !(this.isToplevel() || isConstructor);
677 if (isMethodCall) { 687 if (isMethodCall) {
678 var typeName = GetTypeName(GET_PRIVATE(this, CallSiteReceiverKey), true); 688 var typeName = GetTypeName(GET_PRIVATE(this, CallSiteReceiverKey), true);
679 var methodName = this.getMethodName(); 689 var methodName = this.getMethodName();
680 if (functionName) { 690 if (functionName) {
681 if (typeName && 691 if (typeName &&
682 %_CallFunction(functionName, typeName, $stringIndexOf) != 0) { 692 %_CallFunction(functionName, typeName, StringIndexOf) != 0) {
683 line += typeName + "."; 693 line += typeName + ".";
684 } 694 }
685 line += functionName; 695 line += functionName;
686 if (methodName && 696 if (methodName &&
687 (%_CallFunction(functionName, "." + methodName, $stringIndexOf) != 697 (%_CallFunction(functionName, "." + methodName, StringIndexOf) !=
688 functionName.length - methodName.length - 1)) { 698 functionName.length - methodName.length - 1)) {
689 line += " [as " + methodName + "]"; 699 line += " [as " + methodName + "]";
690 } 700 }
691 } else { 701 } else {
692 line += typeName + "." + (methodName || "<anonymous>"); 702 line += typeName + "." + (methodName || "<anonymous>");
693 } 703 }
694 } else if (isConstructor) { 704 } else if (isConstructor) {
695 line += "new " + (functionName || "<anonymous>"); 705 line += "new " + (functionName || "<anonymous>");
696 } else if (functionName) { 706 } else if (functionName) {
697 line += functionName; 707 line += functionName;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 return MakeGenericError(GlobalURIError, kURIMalformed); 1077 return MakeGenericError(GlobalURIError, kURIMalformed);
1068 } 1078 }
1069 1079
1070 //Boilerplate for exceptions for stack overflows. Used from 1080 //Boilerplate for exceptions for stack overflows. Used from
1071 //Isolate::StackOverflow(). 1081 //Isolate::StackOverflow().
1072 $stackOverflowBoilerplate = MakeRangeError(kStackOverflow); 1082 $stackOverflowBoilerplate = MakeRangeError(kStackOverflow);
1073 %DefineAccessorPropertyUnchecked($stackOverflowBoilerplate, 'stack', 1083 %DefineAccessorPropertyUnchecked($stackOverflowBoilerplate, 'stack',
1074 StackTraceGetter, StackTraceSetter, DONT_ENUM); 1084 StackTraceGetter, StackTraceSetter, DONT_ENUM);
1075 1085
1076 }) 1086 })
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