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

Side by Side Diff: src/templates.js

Issue 1094563002: Wrap map and set implementation in functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/promise.js ('k') | src/weak-collection.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "use strict"; 5 // Called from a desugaring in the parser.
6 6
7 // Called from a desugaring in the parser. 7 var $getTemplateCallSite;
8 var GetTemplateCallSite;
9 8
10 (function() { 9 (function() {
11 10
11 "use strict";
12
12 %CheckIsBootstrapping(); 13 %CheckIsBootstrapping();
13 14
14 var callSiteCache = new $Map; 15 var callSiteCache = new global.Map;
15 var mapGetFn = $Map.prototype.get; 16 var mapGetFn = global.Map.prototype.get;
16 var mapSetFn = $Map.prototype.set; 17 var mapSetFn = global.Map.prototype.set;
17 18
18 19
19 function SameCallSiteElements(rawStrings, other) { 20 function SameCallSiteElements(rawStrings, other) {
20 var length = rawStrings.length; 21 var length = rawStrings.length;
21 var other = other.raw; 22 var other = other.raw;
22 23
23 if (length !== other.length) return false; 24 if (length !== other.length) return false;
24 25
25 for (var i = 0; i < length; ++i) { 26 for (var i = 0; i < length; ++i) {
26 if (rawStrings[i] !== other[i]) return false; 27 if (rawStrings[i] !== other[i]) return false;
(...skipping 24 matching lines...) Expand all
51 array[0] = siteObj; 52 array[0] = siteObj;
52 %_CallFunction(callSiteCache, hash, array, mapSetFn); 53 %_CallFunction(callSiteCache, hash, array, mapSetFn);
53 } else { 54 } else {
54 obj.push(siteObj); 55 obj.push(siteObj);
55 } 56 }
56 57
57 return siteObj; 58 return siteObj;
58 } 59 }
59 60
60 61
61 GetTemplateCallSite = function(siteObj, rawStrings, hash) { 62 $getTemplateCallSite = function(siteObj, rawStrings, hash) {
62 var cached = GetCachedCallSite(rawStrings, hash); 63 var cached = GetCachedCallSite(rawStrings, hash);
63 64
64 if (!IS_UNDEFINED(cached)) return cached; 65 if (!IS_UNDEFINED(cached)) return cached;
65 66
66 %AddNamedProperty(siteObj, "raw", %ObjectFreeze(rawStrings), 67 %AddNamedProperty(siteObj, "raw", %ObjectFreeze(rawStrings),
67 READ_ONLY | DONT_ENUM | DONT_DELETE); 68 READ_ONLY | DONT_ENUM | DONT_DELETE);
68 69
69 return SetCachedCallSite(%ObjectFreeze(siteObj), hash); 70 return SetCachedCallSite(%ObjectFreeze(siteObj), hash);
70 } 71 }
71 72
72 })(); 73 })();
OLDNEW
« no previous file with comments | « src/promise.js ('k') | src/weak-collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698