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

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

Issue 1213203007: Create a internal, global native context used only for generated code stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merge with latest Created 5 years, 5 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
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
8 code_stubs.StringLengthTFStub = function StringLengthTFStub(call_conv,
9 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
19 code_stubs.StringAddTFStub = function StringAddTFStub(call_conv, minor_key) {
20 var stub = function(left, right) {
21 return %StringAdd(left, right);
22 }
23 return stub;
24 }
25
26
27 code_stubs.MathFloorStub = function MathFloorStub(call_conv, minor_key) {
28 var stub = function(f, i, v) {
29 // |f| is calling function's JSFunction
30 // |i| is TypeFeedbackVector slot # of callee's CallIC for Math.floor call
31 // |v| is the value to floor
32 var r = %_MathFloor(+v);
33 if (%_IsMinusZero(r)) {
34 // Collect type feedback when the result of the floor is -0. This is
35 // accomplished by storing a sentinel in the second, "extra"
36 // TypeFeedbackVector slot corresponding to the Math.floor CallIC call in
37 // the caller's TypeVector.
38 %_FixedArraySet(%_GetTypeFeedbackVector(f), ((i|0)+1)|0, 1);
39 return -0;
40 }
41 // Return integers in smi range as smis.
42 var trunc = r|0;
43 if (trunc === r) {
44 return trunc;
45 }
46 return r;
47 }
48 return stub;
49 }
50
51 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698