OLD | NEW |
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 // Called from a desugaring in the parser. | 5 // Called from a desugaring in the parser. |
6 | 6 |
7 var $getTemplateCallSite; | |
8 | |
9 (function(global, utils) { | 7 (function(global, utils) { |
10 | 8 |
11 "use strict"; | 9 "use strict"; |
12 | 10 |
13 %CheckIsBootstrapping(); | 11 %CheckIsBootstrapping(); |
14 | 12 |
15 // ------------------------------------------------------------------- | 13 // ------------------------------------------------------------------- |
16 // Imports | 14 // Imports |
17 | 15 |
18 var GlobalMap = global.Map; | 16 var GlobalMap = global.Map; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 array[0] = siteObj; | 58 array[0] = siteObj; |
61 %_CallFunction(callSiteCache, hash, array, mapSetFn); | 59 %_CallFunction(callSiteCache, hash, array, mapSetFn); |
62 } else { | 60 } else { |
63 obj.push(siteObj); | 61 obj.push(siteObj); |
64 } | 62 } |
65 | 63 |
66 return siteObj; | 64 return siteObj; |
67 } | 65 } |
68 | 66 |
69 | 67 |
70 $getTemplateCallSite = function(siteObj, rawStrings, hash) { | 68 function GetTemplateCallSite(siteObj, rawStrings, hash) { |
71 var cached = GetCachedCallSite(rawStrings, hash); | 69 var cached = GetCachedCallSite(rawStrings, hash); |
72 | 70 |
73 if (!IS_UNDEFINED(cached)) return cached; | 71 if (!IS_UNDEFINED(cached)) return cached; |
74 | 72 |
75 %AddNamedProperty(siteObj, "raw", %ObjectFreeze(rawStrings), | 73 %AddNamedProperty(siteObj, "raw", %ObjectFreeze(rawStrings), |
76 READ_ONLY | DONT_ENUM | DONT_DELETE); | 74 READ_ONLY | DONT_ENUM | DONT_DELETE); |
77 | 75 |
78 return SetCachedCallSite(%ObjectFreeze(siteObj), hash); | 76 return SetCachedCallSite(%ObjectFreeze(siteObj), hash); |
79 } | 77 } |
80 | 78 |
| 79 // ---------------------------------------------------------------------------- |
| 80 // Exports |
| 81 |
| 82 %InstallToContext(["get_template_call_site", GetTemplateCallSite]); |
| 83 |
81 }) | 84 }) |
OLD | NEW |