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

Side by Side Diff: src/preparser.cc

Issue 14362023: Replace math.h with cmath (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/platform-win32.cc ('k') | src/runtime.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include <math.h> 28 #include <cmath>
29 29
30 #include "../include/v8stdint.h" 30 #include "../include/v8stdint.h"
31 31
32 #include "allocation.h" 32 #include "allocation.h"
33 #include "checks.h" 33 #include "checks.h"
34 #include "conversions.h" 34 #include "conversions.h"
35 #include "conversions-inl.h" 35 #include "conversions-inl.h"
36 #include "globals.h" 36 #include "globals.h"
37 #include "hashmap.h" 37 #include "hashmap.h"
38 #include "list.h" 38 #include "list.h"
39 #include "preparse-data-format.h" 39 #include "preparse-data-format.h"
40 #include "preparse-data.h" 40 #include "preparse-data.h"
41 #include "preparser.h" 41 #include "preparser.h"
42 #include "unicode.h" 42 #include "unicode.h"
43 #include "utils.h" 43 #include "utils.h"
44 44
45 namespace v8 { 45 #ifdef _MSC_VER
46 namespace std {
46 47
47 #ifdef _MSC_VER
48 // Usually defined in math.h, but not in MSVC. 48 // Usually defined in math.h, but not in MSVC.
49 // Abstracted to work 49 // Abstracted to work
50 int isfinite(double value); 50 int isfinite(double value);
51
52 } // namespace std
51 #endif 53 #endif
52 54
55 namespace v8 {
56
53 namespace preparser { 57 namespace preparser {
54 58
55 PreParser::PreParseResult PreParser::PreParseLazyFunction( 59 PreParser::PreParseResult PreParser::PreParseLazyFunction(
56 i::LanguageMode mode, bool is_generator, i::ParserRecorder* log) { 60 i::LanguageMode mode, bool is_generator, i::ParserRecorder* log) {
57 log_ = log; 61 log_ = log;
58 // Lazy functions always have trivial outer scopes (no with/catch scopes). 62 // Lazy functions always have trivial outer scopes (no with/catch scopes).
59 Scope top_scope(&scope_, kTopLevelScope); 63 Scope top_scope(&scope_, kTopLevelScope);
60 set_language_mode(mode); 64 set_language_mode(mode);
61 Scope function_scope(&scope_, kFunctionScope); 65 Scope function_scope(&scope_, kFunctionScope);
62 function_scope.set_is_generator(is_generator); 66 function_scope.set_is_generator(is_generator);
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 ASSERT(key.length() > 0); 1709 ASSERT(key.length() > 0);
1706 // Quick check for already being in canonical form. 1710 // Quick check for already being in canonical form.
1707 if (IsNumberCanonical(key)) { 1711 if (IsNumberCanonical(key)) {
1708 return AddAsciiSymbol(key, value); 1712 return AddAsciiSymbol(key, value);
1709 } 1713 }
1710 1714
1711 int flags = i::ALLOW_HEX | i::ALLOW_OCTALS; 1715 int flags = i::ALLOW_HEX | i::ALLOW_OCTALS;
1712 double double_value = StringToDouble(unicode_constants_, key, flags, 0.0); 1716 double double_value = StringToDouble(unicode_constants_, key, flags, 0.0);
1713 int length; 1717 int length;
1714 const char* string; 1718 const char* string;
1715 if (!isfinite(double_value)) { 1719 if (!std::isfinite(double_value)) {
1716 string = "Infinity"; 1720 string = "Infinity";
1717 length = 8; // strlen("Infinity"); 1721 length = 8; // strlen("Infinity");
1718 } else { 1722 } else {
1719 string = DoubleToCString(double_value, 1723 string = DoubleToCString(double_value,
1720 i::Vector<char>(number_buffer_, kBufferSize)); 1724 i::Vector<char>(number_buffer_, kBufferSize));
1721 length = i::StrLength(string); 1725 length = i::StrLength(string);
1722 } 1726 }
1723 return AddSymbol(i::Vector<const byte>(reinterpret_cast<const byte*>(string), 1727 return AddSymbol(i::Vector<const byte>(reinterpret_cast<const byte*>(string),
1724 length), true, value); 1728 length), true, value);
1725 } 1729 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); 1810 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1807 } 1811 }
1808 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); 1812 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1809 } 1813 }
1810 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); 1814 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
1811 1815
1812 backing_store_.AddBlock(bytes); 1816 backing_store_.AddBlock(bytes);
1813 return backing_store_.EndSequence().start(); 1817 return backing_store_.EndSequence().start();
1814 } 1818 }
1815 } } // v8::preparser 1819 } } // v8::preparser
OLDNEW
« no previous file with comments | « src/platform-win32.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698