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

Side by Side Diff: src/code-stubs.js

Issue 1398733002: Move builtin JavaScript sources into own directory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Also move macros.py file. Created 5 years, 2 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/arraybuffer.js ('k') | src/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
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 (function(global, code_stubs) {
6
7 "use strict";
8
9 code_stubs.StringLengthTFStub = function StringLengthTFStub(call_conv, minor_key ) {
10 var stub = function(receiver, name, i, v) {
11 // i and v are dummy parameters mandated by the InterfaceDescriptor,
12 // (LoadWithVectorDescriptor).
13 return %_StringGetLength(%_JSValueGetValue(receiver));
14 }
15 return stub;
16 }
17
18 code_stubs.StringAddTFStub = function StringAddTFStub(call_conv, minor_key) {
19 var stub = function(left, right) {
20 return %StringAdd(left, right);
21 }
22 return stub;
23 }
24
25 const kTurboFanICCallModeMask = 1;
26 const kTurboFanICCallForUnptimizedCode = 0;
27 const kTurboFanICCallForOptimizedCode = 1;
28
29 code_stubs.MathFloorStub = function MathFloorStub(call_conv, minor_key) {
30 var call_from_optimized_ic = function(f, i, tv, receiver, v) {
31 "use strict";
32 // |f| is this function's JSFunction
33 // |i| is TypeFeedbackVector slot # of callee's CallIC for Math.floor call
34 // |receiver| is receiver, should not be used
35 // |tv| is the calling function's type vector
36 // |v| is the value to floor
37 if (f !== %_FixedArrayGet(tv, i|0)) {
38 return %_CallFunction(receiver, v, f);
39 }
40 var r = %_MathFloor(+v);
41 if (%_IsMinusZero(r)) {
42 // Collect type feedback when the result of the floor is -0. This is
43 // accomplished by storing a sentinel in the second, "extra"
44 // TypeFeedbackVector slot corresponding to the Math.floor CallIC call in
45 // the caller's TypeVector.
46 %_FixedArraySet(tv, ((i|0)+1)|0, 1);
47 return -0;
48 }
49 // Return integers in smi range as smis.
50 var trunc = r|0;
51 if (trunc === r) {
52 return trunc;
53 }
54 return r;
55 }
56 var call_mode = (minor_key & kTurboFanICCallModeMask);
57 if (call_mode == kTurboFanICCallForOptimizedCode) {
58 return call_from_optimized_ic;
59 } else {
60 %SetForceInlineFlag(call_from_optimized_ic);
61 var call_from_unoptimized_ic = function(f, i, receiver, v) {
62 var tv = %_GetTypeFeedbackVector(%_GetCallerJSFunction());
63 return call_from_optimized_ic(f, i, tv, receiver, v);
64 }
65 return call_from_unoptimized_ic;
66 }
67 }
68
69 })
OLDNEW
« no previous file with comments | « src/arraybuffer.js ('k') | src/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698