Index: src/extensions/i18n/number-format.h |
diff --git a/src/hydrogen-infer-representation.h b/src/extensions/i18n/number-format.h |
similarity index 57% |
copy from src/hydrogen-infer-representation.h |
copy to src/extensions/i18n/number-format.h |
index 7c605696c4b956152bdd9dfc74c83e80569e3714..d4dbc4d6f3be4f665ab034352c57077772050f18 100644 |
--- a/src/hydrogen-infer-representation.h |
+++ b/src/extensions/i18n/number-format.h |
@@ -24,34 +24,46 @@ |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+// limitations under the License. |
-#ifndef V8_HYDROGEN_INFER_REPRESENTATION_H_ |
-#define V8_HYDROGEN_INFER_REPRESENTATION_H_ |
+#ifndef V8_EXTENSIONS_I18N_NUMBER_FORMAT_H_ |
+#define V8_EXTENSIONS_I18N_NUMBER_FORMAT_H_ |
-#include "hydrogen.h" |
+#include "unicode/uversion.h" |
+#include "v8.h" |
-namespace v8 { |
-namespace internal { |
+namespace U_ICU_NAMESPACE { |
+class DecimalFormat; |
+} |
+namespace v8_i18n { |
-class HInferRepresentationPhase : public HPhase { |
+class NumberFormat { |
public: |
- explicit HInferRepresentationPhase(HGraph* graph) |
- : HPhase("H_Infer representations", graph), |
- worklist_(8, zone()), |
- in_worklist_(graph->GetMaximumValueID(), zone()) { } |
+ static void JSCreateNumberFormat( |
+ const v8::FunctionCallbackInfo<v8::Value>& args); |
- void Run(); |
- void AddToWorklist(HValue* current); |
+ // Helper methods for various bindings. |
- private: |
- ZoneList<HValue*> worklist_; |
- BitVector in_worklist_; |
+ // Unpacks date format object from corresponding JavaScript object. |
+ static icu::DecimalFormat* UnpackNumberFormat(v8::Handle<v8::Object> obj); |
- DISALLOW_COPY_AND_ASSIGN(HInferRepresentationPhase); |
-}; |
+ // Release memory we allocated for the NumberFormat once the JS object that |
+ // holds the pointer gets garbage collected. |
+ static void DeleteNumberFormat(v8::Isolate* isolate, |
+ v8::Persistent<v8::Object>* object, |
+ void* param); |
+ |
+ // Formats number and returns corresponding string. |
+ static void JSInternalFormat(const v8::FunctionCallbackInfo<v8::Value>& args); |
+ // Parses a string and returns a number. |
+ static void JSInternalParse(const v8::FunctionCallbackInfo<v8::Value>& args); |
+ |
+ private: |
+ NumberFormat(); |
+}; |
-} } // namespace v8::internal |
+} // namespace v8_i18n |
-#endif // V8_HYDROGEN_INFER_REPRESENTATION_H_ |
+#endif // V8_EXTENSIONS_I18N_NUMBER_FORMAT_H_ |