| OLD | NEW |
| 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 |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 | 1237 |
| 1238 | 1238 |
| 1239 class HCallConstantFunction: public HCall<0> { | 1239 class HCallConstantFunction: public HCall<0> { |
| 1240 public: | 1240 public: |
| 1241 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | 1241 HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
| 1242 : HCall<0>(argument_count), function_(function) { } | 1242 : HCall<0>(argument_count), function_(function) { } |
| 1243 | 1243 |
| 1244 Handle<JSFunction> function() const { return function_; } | 1244 Handle<JSFunction> function() const { return function_; } |
| 1245 | 1245 |
| 1246 bool IsApplyFunction() const { | 1246 bool IsApplyFunction() const { |
| 1247 return function_->code() == Builtins::builtin(Builtins::FunctionApply); | 1247 return function_->code() == |
| 1248 Isolate::Current()->builtins()->builtin(Builtins::FunctionApply); |
| 1248 } | 1249 } |
| 1249 | 1250 |
| 1250 virtual void PrintDataTo(StringStream* stream); | 1251 virtual void PrintDataTo(StringStream* stream); |
| 1251 | 1252 |
| 1252 virtual Representation RequiredInputRepresentation(int index) const { | 1253 virtual Representation RequiredInputRepresentation(int index) const { |
| 1253 return Representation::None(); | 1254 return Representation::None(); |
| 1254 } | 1255 } |
| 1255 | 1256 |
| 1256 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function") | 1257 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function") |
| 1257 | 1258 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 HValue* context() { return first(); } | 1371 HValue* context() { return first(); } |
| 1371 HValue* constructor() { return second(); } | 1372 HValue* constructor() { return second(); } |
| 1372 | 1373 |
| 1373 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new") | 1374 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new") |
| 1374 }; | 1375 }; |
| 1375 | 1376 |
| 1376 | 1377 |
| 1377 class HCallRuntime: public HCall<0> { | 1378 class HCallRuntime: public HCall<0> { |
| 1378 public: | 1379 public: |
| 1379 HCallRuntime(Handle<String> name, | 1380 HCallRuntime(Handle<String> name, |
| 1380 Runtime::Function* c_function, | 1381 const Runtime::Function* c_function, |
| 1381 int argument_count) | 1382 int argument_count) |
| 1382 : HCall<0>(argument_count), c_function_(c_function), name_(name) { } | 1383 : HCall<0>(argument_count), c_function_(c_function), name_(name) { } |
| 1383 virtual void PrintDataTo(StringStream* stream); | 1384 virtual void PrintDataTo(StringStream* stream); |
| 1384 | 1385 |
| 1385 Runtime::Function* function() const { return c_function_; } | 1386 const Runtime::Function* function() const { return c_function_; } |
| 1386 Handle<String> name() const { return name_; } | 1387 Handle<String> name() const { return name_; } |
| 1387 | 1388 |
| 1388 virtual Representation RequiredInputRepresentation(int index) const { | 1389 virtual Representation RequiredInputRepresentation(int index) const { |
| 1389 return Representation::None(); | 1390 return Representation::None(); |
| 1390 } | 1391 } |
| 1391 | 1392 |
| 1392 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") | 1393 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") |
| 1393 | 1394 |
| 1394 private: | 1395 private: |
| 1395 Runtime::Function* c_function_; | 1396 const Runtime::Function* c_function_; |
| 1396 Handle<String> name_; | 1397 Handle<String> name_; |
| 1397 }; | 1398 }; |
| 1398 | 1399 |
| 1399 | 1400 |
| 1400 class HJSArrayLength: public HUnaryOperation { | 1401 class HJSArrayLength: public HUnaryOperation { |
| 1401 public: | 1402 public: |
| 1402 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) { | 1403 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) { |
| 1403 // The length of an array is stored as a tagged value in the array | 1404 // The length of an array is stored as a tagged value in the array |
| 1404 // object. It is guaranteed to be 32 bit integer, but it can be | 1405 // object. It is guaranteed to be 32 bit integer, but it can be |
| 1405 // represented as either a smi or heap number. | 1406 // represented as either a smi or heap number. |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 Handle<JSObject> prototype() const { return prototype_; } | 1764 Handle<JSObject> prototype() const { return prototype_; } |
| 1764 Handle<JSObject> holder() const { return holder_; } | 1765 Handle<JSObject> holder() const { return holder_; } |
| 1765 | 1766 |
| 1766 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") | 1767 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") |
| 1767 | 1768 |
| 1768 virtual Representation RequiredInputRepresentation(int index) const { | 1769 virtual Representation RequiredInputRepresentation(int index) const { |
| 1769 return Representation::None(); | 1770 return Representation::None(); |
| 1770 } | 1771 } |
| 1771 | 1772 |
| 1772 virtual intptr_t Hashcode() { | 1773 virtual intptr_t Hashcode() { |
| 1773 ASSERT(!Heap::IsAllocationAllowed()); | 1774 ASSERT(!HEAP->IsAllocationAllowed()); |
| 1774 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); | 1775 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); |
| 1775 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); | 1776 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); |
| 1776 return hash; | 1777 return hash; |
| 1777 } | 1778 } |
| 1778 | 1779 |
| 1779 protected: | 1780 protected: |
| 1780 virtual bool DataEquals(HValue* other) { | 1781 virtual bool DataEquals(HValue* other) { |
| 1781 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); | 1782 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); |
| 1782 return prototype_.is_identical_to(b->prototype()) && | 1783 return prototype_.is_identical_to(b->prototype()) && |
| 1783 holder_.is_identical_to(b->holder()); | 1784 holder_.is_identical_to(b->holder()); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") | 1928 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") |
| 1928 }; | 1929 }; |
| 1929 | 1930 |
| 1930 | 1931 |
| 1931 class HConstant: public HTemplateInstruction<0> { | 1932 class HConstant: public HTemplateInstruction<0> { |
| 1932 public: | 1933 public: |
| 1933 HConstant(Handle<Object> handle, Representation r); | 1934 HConstant(Handle<Object> handle, Representation r); |
| 1934 | 1935 |
| 1935 Handle<Object> handle() const { return handle_; } | 1936 Handle<Object> handle() const { return handle_; } |
| 1936 | 1937 |
| 1937 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); } | 1938 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
| 1938 | 1939 |
| 1939 virtual Representation RequiredInputRepresentation(int index) const { | 1940 virtual Representation RequiredInputRepresentation(int index) const { |
| 1940 return Representation::None(); | 1941 return Representation::None(); |
| 1941 } | 1942 } |
| 1942 | 1943 |
| 1943 virtual bool EmitAtUses() { return !representation().IsDouble(); } | 1944 virtual bool EmitAtUses() { return !representation().IsDouble(); } |
| 1944 virtual void PrintDataTo(StringStream* stream); | 1945 virtual void PrintDataTo(StringStream* stream); |
| 1945 virtual HType CalculateInferredType(); | 1946 virtual HType CalculateInferredType(); |
| 1946 bool IsInteger() const { return handle_->IsSmi(); } | 1947 bool IsInteger() const { return handle_->IsSmi(); } |
| 1947 HConstant* CopyToRepresentation(Representation r) const; | 1948 HConstant* CopyToRepresentation(Representation r) const; |
| 1948 HConstant* CopyToTruncatedInt32() const; | 1949 HConstant* CopyToTruncatedInt32() const; |
| 1949 bool HasInteger32Value() const { return has_int32_value_; } | 1950 bool HasInteger32Value() const { return has_int32_value_; } |
| 1950 int32_t Integer32Value() const { | 1951 int32_t Integer32Value() const { |
| 1951 ASSERT(HasInteger32Value()); | 1952 ASSERT(HasInteger32Value()); |
| 1952 return int32_value_; | 1953 return int32_value_; |
| 1953 } | 1954 } |
| 1954 bool HasDoubleValue() const { return has_double_value_; } | 1955 bool HasDoubleValue() const { return has_double_value_; } |
| 1955 double DoubleValue() const { | 1956 double DoubleValue() const { |
| 1956 ASSERT(HasDoubleValue()); | 1957 ASSERT(HasDoubleValue()); |
| 1957 return double_value_; | 1958 return double_value_; |
| 1958 } | 1959 } |
| 1959 bool HasStringValue() const { return handle_->IsString(); } | 1960 bool HasStringValue() const { return handle_->IsString(); } |
| 1960 | 1961 |
| 1961 virtual intptr_t Hashcode() { | 1962 virtual intptr_t Hashcode() { |
| 1962 ASSERT(!Heap::allow_allocation(false)); | 1963 ASSERT(!HEAP->allow_allocation(false)); |
| 1963 return reinterpret_cast<intptr_t>(*handle()); | 1964 return reinterpret_cast<intptr_t>(*handle()); |
| 1964 } | 1965 } |
| 1965 | 1966 |
| 1966 #ifdef DEBUG | 1967 #ifdef DEBUG |
| 1967 virtual void Verify() { } | 1968 virtual void Verify() { } |
| 1968 #endif | 1969 #endif |
| 1969 | 1970 |
| 1970 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant") | 1971 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant") |
| 1971 | 1972 |
| 1972 protected: | 1973 protected: |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2811 SetFlag(kUseGVN); | 2812 SetFlag(kUseGVN); |
| 2812 SetFlag(kDependsOnGlobalVars); | 2813 SetFlag(kDependsOnGlobalVars); |
| 2813 } | 2814 } |
| 2814 | 2815 |
| 2815 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 2816 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
| 2816 bool check_hole_value() const { return check_hole_value_; } | 2817 bool check_hole_value() const { return check_hole_value_; } |
| 2817 | 2818 |
| 2818 virtual void PrintDataTo(StringStream* stream); | 2819 virtual void PrintDataTo(StringStream* stream); |
| 2819 | 2820 |
| 2820 virtual intptr_t Hashcode() { | 2821 virtual intptr_t Hashcode() { |
| 2821 ASSERT(!Heap::allow_allocation(false)); | 2822 ASSERT(!HEAP->allow_allocation(false)); |
| 2822 return reinterpret_cast<intptr_t>(*cell_); | 2823 return reinterpret_cast<intptr_t>(*cell_); |
| 2823 } | 2824 } |
| 2824 | 2825 |
| 2825 virtual Representation RequiredInputRepresentation(int index) const { | 2826 virtual Representation RequiredInputRepresentation(int index) const { |
| 2826 return Representation::None(); | 2827 return Representation::None(); |
| 2827 } | 2828 } |
| 2828 | 2829 |
| 2829 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global") | 2830 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global") |
| 2830 | 2831 |
| 2831 protected: | 2832 protected: |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3497 HValue* object() { return left(); } | 3498 HValue* object() { return left(); } |
| 3498 HValue* key() { return right(); } | 3499 HValue* key() { return right(); } |
| 3499 }; | 3500 }; |
| 3500 | 3501 |
| 3501 #undef DECLARE_INSTRUCTION | 3502 #undef DECLARE_INSTRUCTION |
| 3502 #undef DECLARE_CONCRETE_INSTRUCTION | 3503 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3503 | 3504 |
| 3504 } } // namespace v8::internal | 3505 } } // namespace v8::internal |
| 3505 | 3506 |
| 3506 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3507 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |