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

Side by Side Diff: JavaScriptCore/runtime/Operations.h

Issue 28077: WebKit side of merge from r41149 to r41181. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/WebKit/
Patch Set: Created 11 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « JavaScriptCore/runtime/JSString.h ('k') | JavaScriptCore/wrec/WREC.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
3 * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reser ved. 3 * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reser ved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 inline bool jsLess(CallFrame* callFrame, JSValuePtr v1, JSValuePtr v2) 139 inline bool jsLess(CallFrame* callFrame, JSValuePtr v1, JSValuePtr v2)
140 { 140 {
141 if (JSValuePtr::areBothInt32Fast(v1, v2)) 141 if (JSValuePtr::areBothInt32Fast(v1, v2))
142 return v1.getInt32Fast() < v2.getInt32Fast(); 142 return v1.getInt32Fast() < v2.getInt32Fast();
143 143
144 double n1; 144 double n1;
145 double n2; 145 double n2;
146 if (v1.getNumber(n1) && v2.getNumber(n2)) 146 if (v1.getNumber(n1) && v2.getNumber(n2))
147 return n1 < n2; 147 return n1 < n2;
148 148
149 Interpreter* interpreter = callFrame->interpreter(); 149 JSGlobalData* globalData = &callFrame->globalData();
150 if (interpreter->isJSString(v1) && interpreter->isJSString(v2)) 150 if (isJSString(globalData, v1) && isJSString(globalData, v2))
151 return asString(v1)->value() < asString(v2)->value(); 151 return asString(v1)->value() < asString(v2)->value();
152 152
153 JSValuePtr p1; 153 JSValuePtr p1;
154 JSValuePtr p2; 154 JSValuePtr p2;
155 bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 155 bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1);
156 bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 156 bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2);
157 157
158 if (wasNotString1 | wasNotString2) 158 if (wasNotString1 | wasNotString2)
159 return n1 < n2; 159 return n1 < n2;
160 160
161 return asString(p1)->value() < asString(p2)->value(); 161 return asString(p1)->value() < asString(p2)->value();
162 } 162 }
163 163
164 inline bool jsLessEq(CallFrame* callFrame, JSValuePtr v1, JSValuePtr v2) 164 inline bool jsLessEq(CallFrame* callFrame, JSValuePtr v1, JSValuePtr v2)
165 { 165 {
166 if (JSValuePtr::areBothInt32Fast(v1, v2)) 166 if (JSValuePtr::areBothInt32Fast(v1, v2))
167 return v1.getInt32Fast() <= v2.getInt32Fast(); 167 return v1.getInt32Fast() <= v2.getInt32Fast();
168 168
169 double n1; 169 double n1;
170 double n2; 170 double n2;
171 if (v1.getNumber(n1) && v2.getNumber(n2)) 171 if (v1.getNumber(n1) && v2.getNumber(n2))
172 return n1 <= n2; 172 return n1 <= n2;
173 173
174 Interpreter* interpreter = callFrame->interpreter(); 174 JSGlobalData* globalData = &callFrame->globalData();
175 if (interpreter->isJSString(v1) && interpreter->isJSString(v2)) 175 if (isJSString(globalData, v1) && isJSString(globalData, v2))
176 return !(asString(v2)->value() < asString(v1)->value()); 176 return !(asString(v2)->value() < asString(v1)->value());
177 177
178 JSValuePtr p1; 178 JSValuePtr p1;
179 JSValuePtr p2; 179 JSValuePtr p2;
180 bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 180 bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1);
181 bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 181 bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2);
182 182
183 if (wasNotString1 | wasNotString2) 183 if (wasNotString1 | wasNotString2)
184 return n1 <= n2; 184 return n1 <= n2;
185 185
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 ++next; 286 ++next;
287 } 287 }
288 288
289 ASSERT_NOT_REACHED(); 289 ASSERT_NOT_REACHED();
290 return noValue(); 290 return noValue();
291 } 291 }
292 292
293 } // namespace JSC 293 } // namespace JSC
294 294
295 #endif // Operations_h 295 #endif // Operations_h
OLDNEW
« no previous file with comments | « JavaScriptCore/runtime/JSString.h ('k') | JavaScriptCore/wrec/WREC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698