Changeset 146089 in webkit
- Timestamp:
- Mar 18, 2013 11:09:22 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 51 added
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r146087 r146089 1 2013-03-18 Filip Pizlo <fpizlo@apple.com> 2 3 DFG string conversions and allocations should be inlined 4 https://bugs.webkit.org/show_bug.cgi?id=112376 5 6 Reviewed by Geoffrey Garen. 7 8 * fast/js/dfg-to-string-bad-toString-expected.txt: Added. 9 * fast/js/dfg-to-string-bad-toString.html: Added. 10 * fast/js/dfg-to-string-bad-valueOf-expected.txt: Added. 11 * fast/js/dfg-to-string-bad-valueOf.html: Added. 12 * fast/js/dfg-to-string-int-expected.txt: Added. 13 * fast/js/dfg-to-string-int-or-string-expected.txt: Added. 14 * fast/js/dfg-to-string-int-or-string.html: Added. 15 * fast/js/dfg-to-string-int.html: Added. 16 * fast/js/dfg-to-string-side-effect-clobbers-toString-expected.txt: Added. 17 * fast/js/dfg-to-string-side-effect-clobbers-toString.html: Added. 18 * fast/js/dfg-to-string-side-effect-expected.txt: Added. 19 * fast/js/dfg-to-string-side-effect.html: Added. 20 * fast/js/dfg-to-string-toString-becomes-bad-expected.txt: Added. 21 * fast/js/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype-expected.txt: Added. 22 * fast/js/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype.html: Added. 23 * fast/js/dfg-to-string-toString-becomes-bad.html: Added. 24 * fast/js/dfg-to-string-toString-in-string-expected.txt: Added. 25 * fast/js/dfg-to-string-toString-in-string.html: Added. 26 * fast/js/dfg-to-string-valueOf-becomes-bad-expected.txt: Added. 27 * fast/js/dfg-to-string-valueOf-becomes-bad.html: Added. 28 * fast/js/dfg-to-string-valueOf-in-string-expected.txt: Added. 29 * fast/js/dfg-to-string-valueOf-in-string.html: Added. 30 * fast/js/jsc-test-list: 31 * fast/js/regress/script-tests/string-concat-object.js: Added. 32 (foo): 33 * fast/js/regress/script-tests/string-concat-pair-object.js: Added. 34 (foo): 35 * fast/js/regress/script-tests/string-concat-pair-simple.js: Added. 36 (foo): 37 * fast/js/regress/script-tests/string-concat-simple.js: Added. 38 (foo): 39 * fast/js/regress/script-tests/string-cons-repeat.js: Added. 40 (foo): 41 * fast/js/regress/script-tests/string-cons-tower.js: Added. 42 (foo): 43 * fast/js/regress/string-concat-object-expected.txt: Added. 44 * fast/js/regress/string-concat-object.html: Added. 45 * fast/js/regress/string-concat-pair-object-expected.txt: Added. 46 * fast/js/regress/string-concat-pair-object.html: Added. 47 * fast/js/regress/string-concat-pair-simple-expected.txt: Added. 48 * fast/js/regress/string-concat-pair-simple.html: Added. 49 * fast/js/regress/string-concat-simple-expected.txt: Added. 50 * fast/js/regress/string-concat-simple.html: Added. 51 * fast/js/regress/string-cons-repeat-expected.txt: Added. 52 * fast/js/regress/string-cons-repeat.html: Added. 53 * fast/js/regress/string-cons-tower-expected.txt: Added. 54 * fast/js/regress/string-cons-tower.html: Added. 55 * fast/js/script-tests/dfg-to-string-bad-toString.js: Added. 56 (String.prototype.toString): 57 (foo): 58 * fast/js/script-tests/dfg-to-string-bad-valueOf.js: Added. 59 (String.prototype.valueOf): 60 (foo): 61 * fast/js/script-tests/dfg-to-string-int-or-string.js: Added. 62 (foo): 63 * fast/js/script-tests/dfg-to-string-int.js: Added. 64 (foo): 65 * fast/js/script-tests/dfg-to-string-side-effect-clobbers-toString.js: Added. 66 (foo): 67 * fast/js/script-tests/dfg-to-string-side-effect.js: Added. 68 (foo): 69 * fast/js/script-tests/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype.js: Added. 70 (foo): 71 (.String.prototype.toString): 72 * fast/js/script-tests/dfg-to-string-toString-becomes-bad.js: Added. 73 (foo): 74 (.String.prototype.toString): 75 * fast/js/script-tests/dfg-to-string-toString-in-string.js: Added. 76 (foo): 77 (.argument.toString): 78 * fast/js/script-tests/dfg-to-string-valueOf-becomes-bad.js: Added. 79 (foo): 80 (.String.prototype.valueOf): 81 * fast/js/script-tests/dfg-to-string-valueOf-in-string.js: Added. 82 (foo): 83 (.argument.valueOf): 84 1 85 2013-03-18 Dean Jackson <dino@apple.com> 2 86 -
trunk/LayoutTests/fast/js/jsc-test-list
r145828 r146089 195 195 fast/js/dfg-string-stricteq 196 196 fast/js/dfg-tear-off-arguments-not-activation 197 fast/js/dfg-to-string-bad-toString 198 fast/js/dfg-to-string-bad-valueOf 199 fast/js/dfg-to-string-int-or-string 200 fast/js/dfg-to-string-int 201 fast/js/dfg-to-string-side-effect 202 fast/js/dfg-to-string-side-effect-clobbers-toString 203 fast/js/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype 204 fast/js/dfg-to-string-toString-becomes-bad 205 fast/js/dfg-to-string-toString-in-string 206 fast/js/dfg-to-string-valueOf-becomes-bad 207 fast/js/dfg-to-string-valueOf-in-string 197 208 fast/js/dfg-uint16array 198 209 fast/js/dfg-uint32-to-number-in-middle-of-copy-propagation -
trunk/Source/JavaScriptCore/CMakeLists.txt
r146071 r146089 334 334 runtime/RegExpPrototype.cpp 335 335 runtime/StringConstructor.cpp 336 runtime/StringPrototype.cpp337 336 ) 338 337 -
trunk/Source/JavaScriptCore/ChangeLog
r146071 r146089 1 2013-03-15 Filip Pizlo <fpizlo@apple.com> 2 3 DFG string conversions and allocations should be inlined 4 https://bugs.webkit.org/show_bug.cgi?id=112376 5 6 Reviewed by Geoffrey Garen. 7 8 This turns new String(), String(), String.prototype.valueOf(), and 9 String.prototype.toString() into intrinsics. It gives the DFG the ability to handle 10 conversions from StringObject to JSString and vice-versa, and also gives it the 11 ability to handle cases where a variable may be either a StringObject or a JSString. 12 To do this, I added StringObject to value profiling (and removed the stale 13 distinction between Myarguments and Foreignarguments). I also cleaned up ToPrimitive 14 handling, using some of the new functionality but also taking advantage of the 15 existence of Identity(String:@a). 16 17 This is a 2% SunSpider speed-up. Also there are some speed-ups on V8v7 and Kraken. 18 On microbenchmarks that stress new String() this is a 14x speed-up. 19 20 * CMakeLists.txt: 21 * DerivedSources.make: 22 * DerivedSources.pri: 23 * GNUmakefile.list.am: 24 * bytecode/CodeBlock.h: 25 (CodeBlock): 26 (JSC::CodeBlock::hasExitSite): 27 (JSC): 28 * bytecode/DFGExitProfile.cpp: 29 (JSC::DFG::ExitProfile::hasExitSite): 30 (DFG): 31 * bytecode/DFGExitProfile.h: 32 (ExitProfile): 33 (JSC::DFG::ExitProfile::hasExitSite): 34 * bytecode/ExitKind.cpp: 35 (JSC::exitKindToString): 36 * bytecode/ExitKind.h: 37 * bytecode/SpeculatedType.cpp: 38 (JSC::dumpSpeculation): 39 (JSC::speculationToAbbreviatedString): 40 (JSC::speculationFromClassInfo): 41 * bytecode/SpeculatedType.h: 42 (JSC): 43 (JSC::isStringObjectSpeculation): 44 (JSC::isStringOrStringObjectSpeculation): 45 * create_hash_table: 46 * dfg/DFGAbstractState.cpp: 47 (JSC::DFG::AbstractState::executeEffects): 48 * dfg/DFGAbstractState.h: 49 (JSC::DFG::AbstractState::filterEdgeByUse): 50 * dfg/DFGByteCodeParser.cpp: 51 (ByteCodeParser): 52 (JSC::DFG::ByteCodeParser::handleCall): 53 (JSC::DFG::ByteCodeParser::emitArgumentPhantoms): 54 (DFG): 55 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): 56 * dfg/DFGCSEPhase.cpp: 57 (JSC::DFG::CSEPhase::putStructureStoreElimination): 58 * dfg/DFGEdge.h: 59 (JSC::DFG::Edge::shift): 60 * dfg/DFGFixupPhase.cpp: 61 (JSC::DFG::FixupPhase::fixupNode): 62 (JSC::DFG::FixupPhase::isStringPrototypeMethodSane): 63 (FixupPhase): 64 (JSC::DFG::FixupPhase::canOptimizeStringObjectAccess): 65 (JSC::DFG::FixupPhase::observeUseKindOnNode): 66 * dfg/DFGGraph.h: 67 (JSC::DFG::Graph::hasGlobalExitSite): 68 (Graph): 69 (JSC::DFG::Graph::hasExitSite): 70 (JSC::DFG::Graph::clobbersWorld): 71 * dfg/DFGNode.h: 72 (JSC::DFG::Node::convertToToString): 73 (Node): 74 (JSC::DFG::Node::hasStructure): 75 (JSC::DFG::Node::shouldSpeculateStringObject): 76 (JSC::DFG::Node::shouldSpeculateStringOrStringObject): 77 * dfg/DFGNodeType.h: 78 (DFG): 79 * dfg/DFGOperations.cpp: 80 * dfg/DFGOperations.h: 81 * dfg/DFGPredictionPropagationPhase.cpp: 82 (JSC::DFG::PredictionPropagationPhase::propagate): 83 * dfg/DFGSpeculativeJIT.cpp: 84 (JSC::DFG::SpeculativeJIT::compileToStringOnCell): 85 (DFG): 86 (JSC::DFG::SpeculativeJIT::compileNewStringObject): 87 (JSC::DFG::SpeculativeJIT::speculateObject): 88 (JSC::DFG::SpeculativeJIT::speculateObjectOrOther): 89 (JSC::DFG::SpeculativeJIT::speculateString): 90 (JSC::DFG::SpeculativeJIT::speculateStringObject): 91 (JSC::DFG::SpeculativeJIT::speculateStringOrStringObject): 92 (JSC::DFG::SpeculativeJIT::speculate): 93 * dfg/DFGSpeculativeJIT.h: 94 (JSC::DFG::SpeculativeJIT::callOperation): 95 (SpeculativeJIT): 96 (JSC::DFG::SpeculateCellOperand::SpeculateCellOperand): 97 (DFG): 98 (JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure): 99 * dfg/DFGSpeculativeJIT32_64.cpp: 100 (JSC::DFG::SpeculativeJIT::fillSpeculateCell): 101 (JSC::DFG::SpeculativeJIT::compile): 102 * dfg/DFGSpeculativeJIT64.cpp: 103 (JSC::DFG::SpeculativeJIT::fillSpeculateCell): 104 (JSC::DFG::SpeculativeJIT::compile): 105 * dfg/DFGUseKind.cpp: 106 (WTF::printInternal): 107 * dfg/DFGUseKind.h: 108 (JSC::DFG::typeFilterFor): 109 * interpreter/CallFrame.h: 110 (JSC::ExecState::regExpPrototypeTable): 111 * runtime/CommonIdentifiers.h: 112 * runtime/Intrinsic.h: 113 * runtime/JSDestructibleObject.h: 114 (JSDestructibleObject): 115 (JSC::JSDestructibleObject::classInfoOffset): 116 * runtime/JSGlobalData.cpp: 117 (JSC): 118 (JSC::JSGlobalData::JSGlobalData): 119 (JSC::JSGlobalData::~JSGlobalData): 120 * runtime/JSGlobalData.h: 121 (JSGlobalData): 122 * runtime/JSObject.cpp: 123 * runtime/JSObject.h: 124 (JSC): 125 * runtime/JSWrapperObject.h: 126 (JSC::JSWrapperObject::allocationSize): 127 (JSWrapperObject): 128 (JSC::JSWrapperObject::internalValueOffset): 129 (JSC::JSWrapperObject::internalValueCellOffset): 130 * runtime/StringPrototype.cpp: 131 (JSC): 132 (JSC::StringPrototype::finishCreation): 133 (JSC::StringPrototype::create): 134 * runtime/StringPrototype.h: 135 (StringPrototype): 136 1 137 2013-03-18 Filip Pizlo <fpizlo@apple.com> 2 138 -
trunk/Source/JavaScriptCore/DerivedSources.make
r146071 r146089 1 # Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.1 # Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 56 56 RegExpObject.lut.h \ 57 57 StringConstructor.lut.h \ 58 StringPrototype.lut.h \59 58 docs/bytecode.html \ 60 59 udis86_itab.h \ -
trunk/Source/JavaScriptCore/DerivedSources.pri
r146071 r146089 25 25 runtime/RegExpPrototype.cpp \ 26 26 runtime/StringConstructor.cpp \ 27 runtime/StringPrototype.cpp \28 27 29 28 KEYWORDLUT_FILES += \ -
trunk/Source/JavaScriptCore/GNUmakefile.list.am
r146071 r146089 29 29 DerivedSources/JavaScriptCore/RegExpPrototype.lut.h \ 30 30 DerivedSources/JavaScriptCore/StringConstructor.lut.h \ 31 DerivedSources/JavaScriptCore/StringPrototype.lut.h \32 31 DerivedSources/JavaScriptCore/LLIntDesiredOffsets.h \ 33 32 DerivedSources/JavaScriptCore/LLIntAssembly.h -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r145000 r146089 788 788 return m_exitProfile.add(site); 789 789 } 790 791 bool hasExitSite(const DFG::FrequentExitSite& site) const { return m_exitProfile.hasExitSite(site); } 790 792 791 793 DFG::ExitProfile& exitProfile() { return m_exitProfile; } … … 1390 1392 return baselineCodeBlock; 1391 1393 } 1392 1394 1393 1395 inline int CodeBlock::argumentIndexAfterCapture(size_t argument) 1394 1396 { -
trunk/Source/JavaScriptCore/bytecode/DFGExitProfile.cpp
r139021 r146089 71 71 } 72 72 73 bool ExitProfile::hasExitSite(const FrequentExitSite& site) const 74 { 75 if (!m_frequentExitSites) 76 return false; 77 78 for (unsigned i = m_frequentExitSites->size(); i--;) { 79 if (m_frequentExitSites->at(i) == site) 80 return true; 81 } 82 return false; 83 } 84 73 85 QueryableExitProfile::QueryableExitProfile(const ExitProfile& profile) 74 86 { -
trunk/Source/JavaScriptCore/bytecode/DFGExitProfile.h
r139021 r146089 134 134 Vector<FrequentExitSite> exitSitesFor(unsigned bytecodeIndex); 135 135 136 // This is O(n) and should be called on less-frequently executed code paths 137 // in the compiler. It should be strictly cheaper than building a 138 // QueryableExitProfile, if you really expect this to be called infrequently 139 // and you believe that there are few exit sites. 140 bool hasExitSite(const FrequentExitSite&) const; 141 bool hasExitSite(ExitKind kind) const 142 { 143 return hasExitSite(FrequentExitSite(kind)); 144 } 145 bool hasExitSite(unsigned bytecodeIndex, ExitKind kind) const 146 { 147 return hasExitSite(FrequentExitSite(bytecodeIndex, kind)); 148 } 149 136 150 private: 137 151 friend class QueryableExitProfile; -
trunk/Source/JavaScriptCore/bytecode/ExitKind.cpp
r140594 r146089 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 65 65 case ArgumentsEscaped: 66 66 return "ArgumentsEscaped"; 67 case NotStringObject: 68 return "NotStringObject"; 67 69 case Uncountable: 68 70 return "Uncountable"; -
trunk/Source/JavaScriptCore/bytecode/ExitKind.h
r138871 r146089 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 45 45 InadequateCoverage, // We exited because we ended up in code that didn't have profiling coverage. 46 46 ArgumentsEscaped, // We exited because arguments escaped but we didn't expect them to. 47 NotStringObject, // We exited because we shouldn't have attempted to optimize string object access. 47 48 Uncountable, // We exited for none of the above reasons, and we should not count it. Most uses of this should be viewed as a FIXME. 48 49 UncountableWatchpoint // We exited because of a watchpoint, which isn't counted because watchpoints do tracking themselves. -
trunk/Source/JavaScriptCore/bytecode/SpeculatedType.cpp
r139541 r146089 1 1 /* 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 #include "JSFunction.h" 35 35 #include "Operations.h" 36 #include "StringObject.h" 36 37 #include "ValueProfile.h" 37 38 #include <wtf/BoundsCheckedPointer.h> … … 121 122 isTop = false; 122 123 123 if (value & SpecMyArguments) 124 myOut.print("Myarguments"); 125 else 126 isTop = false; 127 128 if (value & SpecForeignArguments) 129 myOut.print("Foreignarguments"); 124 if (value & SpecArguments) 125 myOut.print("Arguments"); 130 126 else 131 127 isTop = false; … … 133 129 if (value & SpecString) 134 130 myOut.print("String"); 131 else 132 isTop = false; 133 134 if (value & SpecStringObject) 135 myOut.print("Stringobject"); 135 136 else 136 137 isTop = false; … … 198 199 if (isFloat64ArraySpeculation(prediction)) 199 200 return "<Float64array>"; 200 if (isMyArgumentsSpeculation(prediction))201 return "<Myarguments>";202 201 if (isArgumentsSpeculation(prediction)) 203 202 return "<Arguments>"; 203 if (isStringObjectSpeculation(prediction)) 204 return "<StringObject>"; 205 if (isStringOrStringObjectSpeculation(prediction)) 206 return "<StringOrStringObject>"; 204 207 if (isObjectSpeculation(prediction)) 205 208 return "<Object>"; … … 233 236 234 237 if (classInfo == &Arguments::s_info) 235 return SpecArguments; // Cannot distinguish between MyArguments and ForeignArguments at this stage. That happens in the flow analysis. 238 return SpecArguments; 239 240 if (classInfo == &StringObject::s_info) 241 return SpecStringObject; 236 242 237 243 if (classInfo->isSubClassOf(&JSFunction::s_info)) 238 244 return SpecFunction; 239 240 245 241 246 if (classInfo->typedArrayStorageType != TypedArrayNone) { -
trunk/Source/JavaScriptCore/bytecode/SpeculatedType.h
r142695 r146089 1 1 /* 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 50 50 static const SpeculatedType SpecFloat32Array = 0x00000800; // It's definitely an Uint16Array or one of its subclasses. 51 51 static const SpeculatedType SpecFloat64Array = 0x00001000; // It's definitely an Uint16Array or one of its subclasses. 52 static const SpeculatedType SpecMyArguments = 0x00002000; // It's definitely an Arguments object, and it's definitely the one for my current frame. 53 static const SpeculatedType SpecForeignArguments = 0x00004000; // It's definitely an Arguments object, and it's definitely not mine. 54 static const SpeculatedType SpecArguments = 0x00006000; // It's definitely an Arguments object. 52 static const SpeculatedType SpecArguments = 0x00002000; // It's definitely an Arguments object. 53 static const SpeculatedType SpecStringObject = 0x00004000; // It's definitely a StringObject. 55 54 static const SpeculatedType SpecObjectOther = 0x00008000; // It's definitely an object but not JSFinalObject, JSArray, or JSFunction. 56 55 static const SpeculatedType SpecObject = 0x0000ffff; // Bitmask used for testing for any kind of object prediction. … … 215 214 } 216 215 217 inline bool isMyArgumentsSpeculation(SpeculatedType value) 218 { 219 return value == SpecMyArguments; 216 inline bool isStringObjectSpeculation(SpeculatedType value) 217 { 218 return value == SpecStringObject; 219 } 220 221 inline bool isStringOrStringObjectSpeculation(SpeculatedType value) 222 { 223 return !!value && !(value & ~(SpecString | SpecStringObject)); 220 224 } 221 225 -
trunk/Source/JavaScriptCore/create_hash_table
r111129 r146089 272 272 273 273 my $intrinsic = "NoIntrinsic"; 274 $intrinsic = "CharCodeAtIntrinsic" if ($key eq "charCodeAt");275 $intrinsic = "CharAtIntrinsic" if ($key eq "charAt");276 274 $intrinsic = "FromCharCodeIntrinsic" if ($key eq "fromCharCode"); 277 275 if ($name eq "mathTable") { -
trunk/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
r145052 r146089 34 34 #include "Operations.h" 35 35 #include "PutByIdStatus.h" 36 #include "StringObject.h" 36 37 37 38 namespace JSC { namespace DFG { … … 770 771 break; 771 772 } 772 forNode(node).set( SpecString);773 forNode(node).set(m_graph.m_globalData.stringStructure.get()); 773 774 break; 774 775 } … … 858 859 case StringCharAt: 859 860 node->setCanExit(true); 860 forNode(node).set( SpecString);861 forNode(node).set(m_graph.m_globalData.stringStructure.get()); 861 862 break; 862 863 … … 877 878 break; 878 879 case Array::String: 879 forNode(node).set( SpecString);880 forNode(node).set(m_graph.m_globalData.stringStructure.get()); 880 881 break; 881 882 case Array::Arguments: … … 1032 1033 } 1033 1034 1034 if (node->child1().useKind() == Int32Use) { 1035 forNode(node).set(SpecInt32); 1036 break; 1037 } 1038 1035 ASSERT(node->child1().useKind() == UntypedUse); 1036 1039 1037 AbstractValue& source = forNode(node->child1()); 1040 1038 AbstractValue& destination = forNode(node); … … 1061 1059 // deal since we don't do any optimization on those currently. 1062 1060 1061 clobberWorld(node->codeOrigin, indexInBlock); 1062 1063 1063 SpeculatedType type = source.m_type; 1064 1064 if (type & ~(SpecNumber | SpecString | SpecBoolean)) { … … 1069 1069 break; 1070 1070 } 1071 1072 case ToString: { 1073 switch (node->child1().useKind()) { 1074 case StringObjectUse: 1075 // This also filters that the StringObject has the primordial StringObject 1076 // structure. 1077 forNode(node->child1()).filter(m_graph.globalObjectFor(node->codeOrigin)->stringObjectStructure()); 1078 node->setCanExit(true); // We could be more precise but it's likely not worth it. 1079 break; 1080 case StringOrStringObjectUse: 1081 node->setCanExit(true); // We could be more precise but it's likely not worth it. 1082 break; 1083 case CellUse: 1084 case UntypedUse: 1085 clobberWorld(node->codeOrigin, indexInBlock); 1086 break; 1087 default: 1088 RELEASE_ASSERT_NOT_REACHED(); 1089 break; 1090 } 1091 forNode(node).set(m_graph.m_globalData.stringStructure.get()); 1092 break; 1093 } 1094 1095 case NewStringObject: { 1096 ASSERT(node->structure()->classInfo() == &StringObject::s_info); 1097 forNode(node).set(node->structure()); 1098 break; 1099 } 1071 1100 1072 1101 case StrCat: 1073 forNode(node).set( SpecString);1102 forNode(node).set(m_graph.m_globalData.stringStructure.get()); 1074 1103 break; 1075 1104 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractState.h
r144991 r146089 191 191 case KnownNumberUse: 192 192 case KnownCellUse: 193 case KnownStringUse: 193 194 ASSERT(!(forNode(edge).m_type & ~typeFilterFor(edge.useKind()))); 194 195 break; -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r145828 r146089 40 40 #include "PutByIdStatus.h" 41 41 #include "ResolveGlobalStatus.h" 42 #include "StringConstructor.h" 42 43 #include <wtf/CommaPrinter.h> 43 44 #include <wtf/HashMap.h> … … 165 166 void handleCall(Interpreter*, Instruction* currentInstruction, NodeType op, CodeSpecializationKind); 166 167 void emitFunctionChecks(const CallLinkStatus&, Node* callTarget, int registerOffset, CodeSpecializationKind); 168 void emitArgumentPhantoms(int registerOffset, int argumentCountIncludingThis, CodeSpecializationKind); 167 169 // Handle inlining. Return true if it succeeded, false if we need to plant a call. 168 170 bool handleInlining(bool usesResult, Node* callTargetNode, int resultOperand, const CallLinkStatus&, int registerOffset, int argumentCountIncludingThis, unsigned nextOffset, CodeSpecializationKind); … … 1207 1209 1208 1210 if (InternalFunction* function = callLinkStatus.internalFunction()) { 1209 if (handleConstantInternalFunction(usesResult, resultOperand, function, registerOffset, argumentCountIncludingThis, prediction, kind)) 1211 if (handleConstantInternalFunction(usesResult, resultOperand, function, registerOffset, argumentCountIncludingThis, prediction, kind)) { 1212 // This phantoming has to be *after* the code for the intrinsic, to signify that 1213 // the inputs must be kept alive whatever exits the intrinsic may do. 1214 addToGraph(Phantom, callTarget); 1215 emitArgumentPhantoms(registerOffset, argumentCountIncludingThis, kind); 1210 1216 return; 1211 1217 } 1218 1212 1219 // Can only handle this using the generic call handler. 1213 1220 addCall(interpreter, currentInstruction, op); … … 1220 1227 1221 1228 if (handleIntrinsic(usesResult, resultOperand, intrinsic, registerOffset, argumentCountIncludingThis, prediction)) { 1222 // Need to keep all inputs alive for OSR, and need to ensure that we get 1223 // backwards propagation of NodeUsedAsValue. Note that inlining doesn't 1224 // need to do this because it already Flushes the arguments, which has a 1225 // similar effect. 1229 // This phantoming has to be *after* the code for the intrinsic, to signify that 1230 // the inputs must be kept alive whatever exits the intrinsic may do. 1226 1231 addToGraph(Phantom, callTarget); 1227 for (int i = 0; i < argumentCountIncludingThis; ++i) 1228 addToGraph(Phantom, get(registerOffset + argumentToOperand(i))); 1229 1232 emitArgumentPhantoms(registerOffset, argumentCountIncludingThis, kind); 1230 1233 return; 1231 1234 } … … 1260 1263 addToGraph(CheckExecutable, OpInfo(callLinkStatus.executable()), callTarget, thisArgument); 1261 1264 } 1265 } 1266 1267 void ByteCodeParser::emitArgumentPhantoms(int registerOffset, int argumentCountIncludingThis, CodeSpecializationKind kind) 1268 { 1269 for (int i = kind == CodeForCall ? 0 : 1; i < argumentCountIncludingThis; ++i) 1270 addToGraph(Phantom, get(registerOffset + argumentToOperand(i))); 1262 1271 } 1263 1272 … … 1629 1638 1630 1639 UNUSED_PARAM(prediction); // Remove this once we do more things. 1631 UNUSED_PARAM(kind); // Remove this once we do more things.1632 1640 1633 1641 if (function->classInfo() == &ArrayConstructor::s_info) { … … 1644 1652 usesResult, resultOperand, 1645 1653 addToGraph(Node::VarArg, NewArray, OpInfo(ArrayWithUndecided), OpInfo(0))); 1654 return true; 1655 } else if (function->classInfo() == &StringConstructor::s_info) { 1656 Node* result; 1657 1658 if (argumentCountIncludingThis <= 1) 1659 result = cellConstant(m_globalData->smallStrings.emptyString()); 1660 else 1661 result = addToGraph(ToString, get(registerOffset + argumentToOperand(1))); 1662 1663 if (kind == CodeForConstruct) 1664 result = addToGraph(NewStringObject, OpInfo(function->globalObject()->stringObjectStructure()), result); 1665 1666 setIntrinsicResult(usesResult, resultOperand, result); 1646 1667 return true; 1647 1668 } -
trunk/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp
r144973 r146089 577 577 case ReallocatePropertyStorage: 578 578 case TypeOf: 579 case ToString: 580 case NewStringObject: 579 581 return 0; 580 582 -
trunk/Source/JavaScriptCore/dfg/DFGEdge.h
r144452 r146089 149 149 150 150 #if USE(JSVALUE64) 151 static uint32_t shift() { return 5; }151 static uint32_t shift() { return 6; } 152 152 153 153 static uintptr_t makeWord(Node* node, UseKind useKind, ProofStatus proofStatus) -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r145578 r146089 527 527 528 528 case ToPrimitive: { 529 if (node->child1()->shouldSpeculateInteger()) 529 if (node->child1()->shouldSpeculateInteger()) { 530 530 setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); 531 node->convertToIdentity(); 532 break; 533 } 534 535 if (node->child1()->shouldSpeculateString()) { 536 setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); 537 node->convertToIdentity(); 538 break; 539 } 540 541 if (node->child1()->shouldSpeculateStringObject() 542 && canOptimizeStringObjectAccess(node->codeOrigin)) { 543 setUseKindAndUnboxIfProfitable<StringObjectUse>(node->child1()); 544 node->convertToToString(); 545 break; 546 } 547 548 if (node->child1()->shouldSpeculateStringOrStringObject() 549 && canOptimizeStringObjectAccess(node->codeOrigin)) { 550 setUseKindAndUnboxIfProfitable<StringOrStringObjectUse>(node->child1()); 551 node->convertToToString(); 552 break; 553 } 554 531 555 // FIXME: Add string speculation here. 532 556 // https://bugs.webkit.org/show_bug.cgi?id=110175 557 break; 558 } 559 560 case ToString: { 561 if (node->child1()->shouldSpeculateString()) { 562 setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); 563 node->convertToIdentity(); 564 break; 565 } 566 567 if (node->child1()->shouldSpeculateStringObject() 568 && canOptimizeStringObjectAccess(node->codeOrigin)) { 569 setUseKindAndUnboxIfProfitable<StringObjectUse>(node->child1()); 570 break; 571 } 572 573 if (node->child1()->shouldSpeculateStringOrStringObject() 574 && canOptimizeStringObjectAccess(node->codeOrigin)) { 575 setUseKindAndUnboxIfProfitable<StringOrStringObjectUse>(node->child1()); 576 break; 577 } 578 579 if (node->child1()->shouldSpeculateCell()) { 580 setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); 581 break; 582 } 583 584 break; 585 } 586 587 case NewStringObject: { 588 setUseKindAndUnboxIfProfitable<KnownStringUse>(node->child1()); 533 589 break; 534 590 } … … 807 863 } 808 864 865 bool isStringPrototypeMethodSane(Structure* stringPrototypeStructure, const Identifier& ident) 866 { 867 unsigned attributesUnused; 868 JSCell* specificValue; 869 PropertyOffset offset = stringPrototypeStructure->get( 870 globalData(), ident, attributesUnused, specificValue); 871 if (!isValidOffset(offset)) 872 return false; 873 874 if (!specificValue) 875 return false; 876 877 if (!specificValue->inherits(&JSFunction::s_info)) 878 return false; 879 880 JSFunction* function = jsCast<JSFunction*>(specificValue); 881 if (function->executable()->intrinsicFor(CodeForCall) != StringPrototypeValueOfIntrinsic) 882 return false; 883 884 return true; 885 } 886 887 bool canOptimizeStringObjectAccess(const CodeOrigin& codeOrigin) 888 { 889 if (m_graph.hasExitSite(codeOrigin, NotStringObject)) 890 return false; 891 892 Structure* stringObjectStructure = m_graph.globalObjectFor(codeOrigin)->stringObjectStructure(); 893 ASSERT(stringObjectStructure->storedPrototype().isObject()); 894 ASSERT(stringObjectStructure->storedPrototype().asCell()->classInfo() == &StringPrototype::s_info); 895 896 JSObject* stringPrototypeObject = asObject(stringObjectStructure->storedPrototype()); 897 Structure* stringPrototypeStructure = stringPrototypeObject->structure(); 898 if (stringPrototypeStructure->transitionWatchpointSetHasBeenInvalidated()) 899 return false; 900 901 if (stringPrototypeStructure->isDictionary()) 902 return false; 903 904 // We're being conservative here. We want DFG's ToString on StringObject to be 905 // used in both numeric contexts (that would call valueOf()) and string contexts 906 // (that would call toString()). We don't want the DFG to have to distinguish 907 // between the two, just because that seems like it would get confusing. So we 908 // just require both methods to be sane. 909 if (!isStringPrototypeMethodSane(stringPrototypeStructure, globalData().propertyNames->valueOf)) 910 return false; 911 if (!isStringPrototypeMethodSane(stringPrototypeStructure, globalData().propertyNames->toString)) 912 return false; 913 914 return true; 915 } 916 809 917 void fixupSetLocalsInBlock(BasicBlock* block) 810 918 { … … 975 1083 case ObjectUse: 976 1084 case StringUse: 1085 case KnownStringUse: 1086 case StringObjectUse: 1087 case StringOrStringObjectUse: 977 1088 if (alwaysUnboxSimplePrimitives() 978 1089 || isCellSpeculation(variable->prediction())) -
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r145052 r146089 377 377 } 378 378 379 bool hasGlobalExitSite(const CodeOrigin& codeOrigin, ExitKind exitKind) 380 { 381 return baselineCodeBlockFor(codeOrigin)->hasExitSite(FrequentExitSite(exitKind)); 382 } 383 384 bool hasExitSite(const CodeOrigin& codeOrigin, ExitKind exitKind) 385 { 386 return baselineCodeBlockFor(codeOrigin)->hasExitSite(FrequentExitSite(codeOrigin.bytecodeIndex, exitKind)); 387 } 388 379 389 int argumentsRegisterFor(const CodeOrigin& codeOrigin) 380 390 { … … 523 533 case PutByValAlias: 524 534 return !byValIsPure(node); 535 case ToString: 536 switch (node->child1().useKind()) { 537 case StringObjectUse: 538 case StringOrStringObjectUse: 539 return false; 540 case CellUse: 541 case UntypedUse: 542 return true; 543 default: 544 RELEASE_ASSERT_NOT_REACHED(); 545 return true; 546 } 525 547 default: 526 548 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r145052 r146089 350 350 } 351 351 352 void convertToToString() 353 { 354 ASSERT(m_op == ToPrimitive); 355 m_op = ToString; 356 } 357 352 358 JSCell* weakConstant() 353 359 { … … 845 851 case ArrayifyToStructure: 846 852 case NewObject: 853 case NewStringObject: 847 854 return true; 848 855 default: … … 1121 1128 } 1122 1129 1130 bool shouldSpeculateStringObject() 1131 { 1132 return isStringObjectSpeculation(prediction()); 1133 } 1134 1135 bool shouldSpeculateStringOrStringObject() 1136 { 1137 return isStringOrStringObjectSpeculation(prediction()); 1138 } 1139 1123 1140 bool shouldSpeculateFinalObject() 1124 1141 { -
trunk/Source/JavaScriptCore/dfg/DFGNodeType.h
r144862 r146089 223 223 macro(LogicalNot, NodeResultBoolean) \ 224 224 macro(ToPrimitive, NodeResultJS | NodeMustGenerate | NodeClobbersWorld) \ 225 macro(ToString, NodeResultJS | NodeMustGenerate | NodeMightClobber) \ 226 macro(NewStringObject, NodeResultJS) \ 225 227 macro(StrCat, NodeResultJS | NodeMustGenerate | NodeHasVarArgs | NodeClobbersWorld) \ 226 228 \ -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r145945 r146089 1546 1546 1547 1547 return string->value(exec).impl(); 1548 } 1549 1550 JSCell* DFG_OPERATION operationNewStringObject(ExecState* exec, JSString* string, Structure* structure) 1551 { 1552 JSGlobalData& globalData = exec->globalData(); 1553 NativeCallFrameTracer tracer(&globalData, exec); 1554 1555 return StringObject::create(exec, structure, string); 1556 } 1557 1558 JSCell* DFG_OPERATION operationToStringOnCell(ExecState* exec, JSCell* cell) 1559 { 1560 JSGlobalData& globalData = exec->globalData(); 1561 NativeCallFrameTracer tracer(&globalData, exec); 1562 1563 return JSValue(cell).toString(exec); 1564 } 1565 1566 JSCell* DFG_OPERATION operationToString(ExecState* exec, EncodedJSValue value) 1567 { 1568 JSGlobalData& globalData = exec->globalData(); 1569 NativeCallFrameTracer tracer(&globalData, exec); 1570 1571 return JSValue::decode(value).toString(exec); 1548 1572 } 1549 1573 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r143165 r146089 86 86 typedef JSCell* DFG_OPERATION (*C_DFGOperation_ECC)(ExecState*, JSCell*, JSCell*); 87 87 typedef JSCell* DFG_OPERATION (*C_DFGOperation_EIcf)(ExecState*, InlineCallFrame*); 88 typedef JSCell* DFG_OPERATION (*C_DFGOperation_EJ)(ExecState*, EncodedJSValue); 89 typedef JSCell* DFG_OPERATION (*C_DFGOperation_EJssSt)(ExecState*, JSString*, Structure*); 88 90 typedef JSCell* DFG_OPERATION (*C_DFGOperation_EOZ)(ExecState*, JSObject*, int32_t); 89 91 typedef JSCell* DFG_OPERATION (*C_DFGOperation_ESt)(ExecState*, Structure*); … … 213 215 char* DFG_OPERATION operationEnsureArrayStorage(ExecState*, JSCell*); 214 216 StringImpl* DFG_OPERATION operationResolveRope(ExecState*, JSString*); 217 JSCell* DFG_OPERATION operationNewStringObject(ExecState*, JSString*, Structure*); 218 JSCell* DFG_OPERATION operationToStringOnCell(ExecState*, JSCell*); 219 JSCell* DFG_OPERATION operationToString(ExecState*, EncodedJSValue); 215 220 216 221 // This method is used to lookup an exception hander, keyed by faultLocation, which is -
trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
r145491 r146089 414 414 415 415 case StringCharAt: 416 case StrCat: { 416 case StrCat: 417 case ToString: { 417 418 changed |= setPrediction(SpecString); 418 419 break; … … 437 438 changed |= mergePrediction(child); 438 439 } 440 break; 441 } 442 443 case NewStringObject: { 444 changed |= setPrediction(SpecStringObject); 439 445 break; 440 446 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r145933 r146089 3923 3923 } 3924 3924 3925 void SpeculativeJIT::compileToStringOnCell(Node* node) 3926 { 3927 SpeculateCellOperand op1(this, node->child1()); 3928 GPRReg op1GPR = op1.gpr(); 3929 3930 switch (node->child1().useKind()) { 3931 case StringObjectUse: { 3932 GPRTemporary result(this); 3933 GPRReg resultGPR = result.gpr(); 3934 3935 if (!m_state.forNode(node->child1()).m_currentKnownStructure.isSubsetOf(StructureSet(m_jit.globalObjectFor(node->codeOrigin)->stringObjectStructure()))) { 3936 speculateStringObject(op1GPR); 3937 m_state.forNode(node->child1()).filter(SpecStringObject); 3938 } 3939 m_jit.loadPtr(JITCompiler::Address(op1GPR, JSWrapperObject::internalValueCellOffset()), resultGPR); 3940 cellResult(resultGPR, node); 3941 break; 3942 } 3943 3944 case StringOrStringObjectUse: { 3945 GPRTemporary result(this); 3946 GPRReg resultGPR = result.gpr(); 3947 3948 m_jit.loadPtr(JITCompiler::Address(op1GPR, JSCell::structureOffset()), resultGPR); 3949 JITCompiler::Jump isString = m_jit.branchPtr( 3950 JITCompiler::Equal, resultGPR, TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 3951 3952 speculateStringObjectForStructure(resultGPR); 3953 3954 m_jit.loadPtr(JITCompiler::Address(op1GPR, JSWrapperObject::internalValueCellOffset()), resultGPR); 3955 3956 JITCompiler::Jump done = m_jit.jump(); 3957 isString.link(&m_jit); 3958 m_jit.move(op1GPR, resultGPR); 3959 done.link(&m_jit); 3960 3961 m_state.forNode(node->child1()).filter(SpecString | SpecStringObject); 3962 3963 cellResult(resultGPR, node); 3964 break; 3965 } 3966 3967 case CellUse: { 3968 GPRResult result(this); 3969 GPRReg resultGPR = result.gpr(); 3970 3971 // We flush registers instead of silent spill/fill because in this mode we 3972 // believe that most likely the input is not a string, and we need to take 3973 // slow path. 3974 flushRegisters(); 3975 JITCompiler::Jump done; 3976 if (node->child1()->prediction() & SpecString) { 3977 done = m_jit.branchPtr( 3978 JITCompiler::Equal, 3979 JITCompiler::Address(op1GPR, JSCell::structureOffset()), 3980 TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 3981 } 3982 callOperation(operationToStringOnCell, resultGPR, op1GPR); 3983 if (done.isSet()) 3984 done.link(&m_jit); 3985 cellResult(resultGPR, node); 3986 break; 3987 } 3988 3989 default: 3990 RELEASE_ASSERT_NOT_REACHED(); 3991 } 3992 } 3993 3994 void SpeculativeJIT::compileNewStringObject(Node* node) 3995 { 3996 SpeculateCellOperand operand(this, node->child1()); 3997 3998 GPRTemporary result(this); 3999 GPRTemporary scratch1(this); 4000 GPRTemporary scratch2(this); 4001 4002 GPRReg operandGPR = operand.gpr(); 4003 GPRReg resultGPR = result.gpr(); 4004 GPRReg scratch1GPR = scratch1.gpr(); 4005 GPRReg scratch2GPR = scratch2.gpr(); 4006 4007 JITCompiler::JumpList slowPath; 4008 4009 emitAllocateJSObject<StringObject>( 4010 resultGPR, TrustedImmPtr(node->structure()), TrustedImmPtr(0), scratch1GPR, scratch2GPR, 4011 slowPath); 4012 4013 m_jit.storePtr( 4014 TrustedImmPtr(&StringObject::s_info), 4015 JITCompiler::Address(resultGPR, JSDestructibleObject::classInfoOffset())); 4016 #if USE(JSVALUE64) 4017 m_jit.store64( 4018 operandGPR, JITCompiler::Address(resultGPR, JSWrapperObject::internalValueOffset())); 4019 #else 4020 m_jit.store32( 4021 TrustedImm32(JSValue::CellTag), 4022 JITCompiler::Address(resultGPR, JSWrapperObject::internalValueOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.tag))); 4023 m_jit.store32( 4024 operandGPR, 4025 JITCompiler::Address(resultGPR, JSWrapperObject::internalValueOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.payload))); 4026 #endif 4027 4028 addSlowPathGenerator(slowPathCall( 4029 slowPath, this, operationNewStringObject, resultGPR, operandGPR, node->structure())); 4030 4031 cellResult(resultGPR, node); 4032 } 4033 3925 4034 void SpeculativeJIT::speculateInt32(Edge edge) 3926 4035 { … … 3974 4083 3975 4084 SpeculateCellOperand operand(this, edge); 4085 GPRReg gpr = operand.gpr(); 3976 4086 DFG_TYPE_CHECK( 3977 JSValueSource::unboxedCell( operand.gpr()), edge, SpecObject, m_jit.branchPtr(4087 JSValueSource::unboxedCell(gpr), edge, SpecObject, m_jit.branchPtr( 3978 4088 MacroAssembler::Equal, 3979 MacroAssembler::Address( operand.gpr(), JSCell::structureOffset()),4089 MacroAssembler::Address(gpr, JSCell::structureOffset()), 3980 4090 MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get()))); 3981 4091 } … … 3994 4104 MacroAssembler::NonZero, gpr, GPRInfo::tagMaskRegister); 3995 4105 DFG_TYPE_CHECK( 3996 JSValueRegs( operand.gpr()), edge, (~SpecCell) | SpecObject, m_jit.branchPtr(4106 JSValueRegs(gpr), edge, (~SpecCell) | SpecObject, m_jit.branchPtr( 3997 4107 MacroAssembler::Equal, 3998 4108 MacroAssembler::Address(gpr, JSCell::structureOffset()), … … 4043 4153 4044 4154 SpeculateCellOperand operand(this, edge); 4155 GPRReg gpr = operand.gpr(); 4045 4156 DFG_TYPE_CHECK( 4046 JSValueSource::unboxedCell( operand.gpr()), edge, SpecString, m_jit.branchPtr(4157 JSValueSource::unboxedCell(gpr), edge, SpecString, m_jit.branchPtr( 4047 4158 MacroAssembler::NotEqual, 4048 MacroAssembler::Address( operand.gpr(), JSCell::structureOffset()),4159 MacroAssembler::Address(gpr, JSCell::structureOffset()), 4049 4160 MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get()))); 4161 } 4162 4163 void SpeculativeJIT::speculateStringObject(GPRReg gpr) 4164 { 4165 speculateStringObjectForStructure(JITCompiler::Address(gpr, JSCell::structureOffset())); 4166 } 4167 4168 void SpeculativeJIT::speculateStringObject(Edge edge) 4169 { 4170 if (!needsTypeCheck(edge, SpecStringObject)) 4171 return; 4172 4173 SpeculateCellOperand operand(this, edge); 4174 GPRReg gpr = operand.gpr(); 4175 if (!needsTypeCheck(edge, SpecStringObject)) 4176 return; 4177 4178 speculateStringObject(gpr); 4179 m_state.forNode(edge).filter(SpecStringObject); 4180 } 4181 4182 void SpeculativeJIT::speculateStringOrStringObject(Edge edge) 4183 { 4184 if (!needsTypeCheck(edge, SpecString | SpecStringObject)) 4185 return; 4186 4187 SpeculateCellOperand operand(this, edge); 4188 GPRReg gpr = operand.gpr(); 4189 if (!needsTypeCheck(edge, SpecString | SpecStringObject)) 4190 return; 4191 4192 GPRTemporary structure(this); 4193 GPRReg structureGPR = structure.gpr(); 4194 4195 m_jit.loadPtr(JITCompiler::Address(gpr, JSCell::structureOffset()), structureGPR); 4196 4197 JITCompiler::Jump isString = m_jit.branchPtr( 4198 JITCompiler::Equal, structureGPR, TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 4199 4200 speculateStringObjectForStructure(structureGPR); 4201 4202 isString.link(&m_jit); 4203 4204 m_state.forNode(edge).filter(SpecString | SpecStringObject); 4050 4205 } 4051 4206 … … 4108 4263 ASSERT(!needsTypeCheck(edge, SpecCell)); 4109 4264 break; 4265 case KnownStringUse: 4266 ASSERT(!needsTypeCheck(edge, SpecString)); 4267 break; 4110 4268 case Int32Use: 4111 4269 speculateInt32(edge); … … 4132 4290 speculateString(edge); 4133 4291 break; 4292 case StringObjectUse: 4293 speculateStringObject(edge); 4294 break; 4295 case StringOrStringObjectUse: 4296 speculateStringOrStringObject(edge); 4297 break; 4134 4298 case NotCellUse: 4135 4299 speculateNotCell(edge); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r145931 r146089 1086 1086 return appendCallWithExceptionCheckSetResult(operation, result); 1087 1087 } 1088 JITCompiler::Call callOperation(C_DFGOperation_EJssSt operation, GPRReg result, GPRReg arg1, Structure* structure) 1089 { 1090 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(structure)); 1091 return appendCallWithExceptionCheckSetResult(operation, result); 1092 } 1093 JITCompiler::Call callOperation(C_DFGOperation_EJ operation, GPRReg result, GPRReg arg1) 1094 { 1095 m_jit.setupArgumentsWithExecState(arg1); 1096 return appendCallWithExceptionCheckSetResult(operation, result); 1097 } 1088 1098 JITCompiler::Call callOperation(S_DFGOperation_J operation, GPRReg result, GPRReg arg1) 1089 1099 { … … 1472 1482 { 1473 1483 m_jit.setupArgumentsWithExecState(TrustedImmPtr(structure)); 1484 return appendCallWithExceptionCheckSetResult(operation, result); 1485 } 1486 JITCompiler::Call callOperation(C_DFGOperation_EJssSt operation, GPRReg result, GPRReg arg1, Structure* structure) 1487 { 1488 m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(structure)); 1489 return appendCallWithExceptionCheckSetResult(operation, result); 1490 } 1491 JITCompiler::Call callOperation(C_DFGOperation_EJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload) 1492 { 1493 m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag); 1474 1494 return appendCallWithExceptionCheckSetResult(operation, result); 1475 1495 } … … 2031 2051 void emitObjectOrOtherBranch(Edge value, BlockIndex taken, BlockIndex notTaken); 2032 2052 void emitBranch(Node*); 2053 2054 void compileToStringOnCell(Node*); 2055 void compileNewStringObject(Node*); 2033 2056 2034 2057 void compileIntegerCompare(Node*, MacroAssembler::RelationalCondition); … … 2205 2228 void speculateObjectOrOther(Edge); 2206 2229 void speculateString(Edge); 2230 template<typename StructureLocationType> 2231 void speculateStringObjectForStructure(StructureLocationType); 2232 void speculateStringObject(GPRReg); 2233 void speculateStringObject(Edge); 2234 void speculateStringOrStringObject(Edge); 2207 2235 void speculateNotCell(Edge); 2208 2236 void speculateOther(Edge); … … 2839 2867 { 2840 2868 ASSERT(m_jit); 2841 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || (edge.useKind() == CellUse || edge.useKind() == KnownCellUse || edge.useKind() == ObjectUse || edge.useKind() == StringUse ));2869 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || (edge.useKind() == CellUse || edge.useKind() == KnownCellUse || edge.useKind() == ObjectUse || edge.useKind() == StringUse || edge.useKind() == KnownStringUse || edge.useKind() == StringObjectUse || edge.useKind() == StringOrStringObjectUse)); 2842 2870 if (jit->isFilled(node())) 2843 2871 gpr(); … … 2925 2953 }; 2926 2954 2955 template<typename StructureLocationType> 2956 void SpeculativeJIT::speculateStringObjectForStructure(StructureLocationType structureLocation) 2957 { 2958 Structure* stringObjectStructure = 2959 m_jit.globalObjectFor(m_currentNode->codeOrigin)->stringObjectStructure(); 2960 Structure* stringPrototypeStructure = stringObjectStructure->storedPrototype().asCell()->structure(); 2961 ASSERT(stringPrototypeStructure->transitionWatchpointSetIsStillValid()); 2962 2963 speculationCheck( 2964 NotStringObject, JSValueRegs(), 0, 2965 m_jit.branchPtr( 2966 JITCompiler::NotEqual, structureLocation, TrustedImmPtr(stringObjectStructure))); 2967 stringPrototypeStructure->addTransitionWatchpoint(speculationWatchpoint(NotStringObject)); 2968 } 2969 2927 2970 #define DFG_TYPE_CHECK(source, edge, typesPassedThrough, jumpToFail) do { \ 2928 2971 if (!needsTypeCheck((edge), (typesPassedThrough))) \ -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r145931 r146089 1100 1100 AbstractValue& value = m_state.forNode(edge); 1101 1101 SpeculatedType type = value.m_type; 1102 ASSERT( edge.useKind() != KnownCellUse|| !(value.m_type & ~SpecCell));1102 ASSERT((edge.useKind() != KnownCellUse && edge.useKind() != KnownStringUse) || !(value.m_type & ~SpecCell)); 1103 1103 value.filter(SpecCell); 1104 1104 VirtualRegister virtualRegister = edge->virtualRegister(); … … 3259 3259 3260 3260 case ToPrimitive: { 3261 switch (node->child1().useKind()) { 3262 case Int32Use: { 3263 // It's really profitable to speculate integer, since it's really cheap, 3264 // it means we don't have to do any real work, and we emit a lot less code. 3265 3266 SpeculateIntegerOperand op1(this, node->child1()); 3267 GPRTemporary result(this, op1); 3268 3269 ASSERT(op1.format() == DataFormatInteger); 3270 m_jit.move(op1.gpr(), result.gpr()); 3271 3272 integerResult(result.gpr(), node); 3273 break; 3274 } 3275 3276 case UntypedUse: { 3261 RELEASE_ASSERT(node->child1().useKind() == UntypedUse); 3262 JSValueOperand op1(this, node->child1()); 3263 GPRTemporary resultTag(this, op1); 3264 GPRTemporary resultPayload(this, op1, false); 3265 3266 GPRReg op1TagGPR = op1.tagGPR(); 3267 GPRReg op1PayloadGPR = op1.payloadGPR(); 3268 GPRReg resultTagGPR = resultTag.gpr(); 3269 GPRReg resultPayloadGPR = resultPayload.gpr(); 3270 3271 op1.use(); 3272 3273 if (!(m_state.forNode(node->child1()).m_type & ~(SpecNumber | SpecBoolean))) { 3274 m_jit.move(op1TagGPR, resultTagGPR); 3275 m_jit.move(op1PayloadGPR, resultPayloadGPR); 3276 } else { 3277 MacroAssembler::Jump alreadyPrimitive = m_jit.branch32(MacroAssembler::NotEqual, op1TagGPR, TrustedImm32(JSValue::CellTag)); 3278 MacroAssembler::Jump notPrimitive = m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1PayloadGPR, JSCell::structureOffset()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 3279 3280 alreadyPrimitive.link(&m_jit); 3281 m_jit.move(op1TagGPR, resultTagGPR); 3282 m_jit.move(op1PayloadGPR, resultPayloadGPR); 3283 3284 addSlowPathGenerator( 3285 slowPathCall( 3286 notPrimitive, this, operationToPrimitive, 3287 JSValueRegs(resultTagGPR, resultPayloadGPR), op1TagGPR, op1PayloadGPR)); 3288 } 3289 3290 jsValueResult(resultTagGPR, resultPayloadGPR, node, UseChildrenCalledExplicitly); 3291 break; 3292 } 3293 3294 case ToString: { 3295 if (node->child1().useKind() == UntypedUse) { 3277 3296 JSValueOperand op1(this, node->child1()); 3278 GPRTemporary resultTag(this, op1); 3279 GPRTemporary resultPayload(this, op1, false); 3280 3297 GPRReg op1PayloadGPR = op1.payloadGPR(); 3281 3298 GPRReg op1TagGPR = op1.tagGPR(); 3282 GPRReg op1PayloadGPR = op1.payloadGPR(); 3283 GPRReg resultTagGPR = resultTag.gpr(); 3284 GPRReg resultPayloadGPR = resultPayload.gpr(); 3285 3286 op1.use(); 3287 3288 if (!(m_state.forNode(node->child1()).m_type & ~(SpecNumber | SpecBoolean))) { 3289 m_jit.move(op1TagGPR, resultTagGPR); 3290 m_jit.move(op1PayloadGPR, resultPayloadGPR); 3291 } else { 3292 MacroAssembler::Jump alreadyPrimitive = m_jit.branch32(MacroAssembler::NotEqual, op1TagGPR, TrustedImm32(JSValue::CellTag)); 3293 MacroAssembler::Jump notPrimitive = m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1PayloadGPR, JSCell::structureOffset()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 3294 3295 alreadyPrimitive.link(&m_jit); 3296 m_jit.move(op1TagGPR, resultTagGPR); 3297 m_jit.move(op1PayloadGPR, resultPayloadGPR); 3298 3299 addSlowPathGenerator( 3300 slowPathCall( 3301 notPrimitive, this, operationToPrimitive, 3302 JSValueRegs(resultTagGPR, resultPayloadGPR), op1TagGPR, op1PayloadGPR)); 3299 3300 GPRResult result(this); 3301 GPRReg resultGPR = result.gpr(); 3302 3303 flushRegisters(); 3304 3305 JITCompiler::Jump done; 3306 if (node->child1()->prediction() & SpecString) { 3307 JITCompiler::Jump slowPath = m_jit.branch32( 3308 JITCompiler::NotEqual, op1TagGPR, TrustedImm32(JSValue::CellTag)); 3309 done = m_jit.branchPtr( 3310 JITCompiler::Equal, 3311 JITCompiler::Address(op1PayloadGPR, JSCell::structureOffset()), 3312 TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 3313 slowPath.link(&m_jit); 3303 3314 } 3304 3305 jsValueResult(resultTagGPR, resultPayloadGPR, node, UseChildrenCalledExplicitly); 3306 break; 3307 } 3308 3309 default: 3310 RELEASE_ASSERT_NOT_REACHED(); 3311 break; 3312 } 3315 callOperation(operationToString, resultGPR, op1TagGPR, op1PayloadGPR); 3316 if (done.isSet()) 3317 done.link(&m_jit); 3318 cellResult(resultGPR, node); 3319 break; 3320 } 3321 3322 compileToStringOnCell(node); 3323 break; 3324 } 3325 3326 case NewStringObject: { 3327 compileNewStringObject(node); 3313 3328 break; 3314 3329 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r145931 r146089 1126 1126 AbstractValue& value = m_state.forNode(edge); 1127 1127 SpeculatedType type = value.m_type; 1128 ASSERT( edge.useKind() != KnownCellUse|| !(value.m_type & ~SpecCell));1128 ASSERT((edge.useKind() != KnownCellUse && edge.useKind() != KnownStringUse) || !(value.m_type & ~SpecCell)); 1129 1129 value.filter(SpecCell); 1130 1130 VirtualRegister virtualRegister = edge->virtualRegister(); … … 3189 3189 3190 3190 case ToPrimitive: { 3191 switch (node->child1().useKind()) { 3192 case Int32Use: { 3193 // It's really profitable to speculate integer, since it's really cheap, 3194 // it means we don't have to do any real work, and we emit a lot less code. 3195 3196 SpeculateIntegerOperand op1(this, node->child1()); 3197 GPRTemporary result(this, op1); 3198 3199 m_jit.move(op1.gpr(), result.gpr()); 3200 if (op1.format() == DataFormatInteger) 3201 m_jit.or64(GPRInfo::tagTypeNumberRegister, result.gpr()); 3202 3203 jsValueResult(result.gpr(), node); 3204 break; 3205 } 3206 3207 case UntypedUse: { 3191 RELEASE_ASSERT(node->child1().useKind() == UntypedUse); 3192 JSValueOperand op1(this, node->child1()); 3193 GPRTemporary result(this, op1); 3194 3195 GPRReg op1GPR = op1.gpr(); 3196 GPRReg resultGPR = result.gpr(); 3197 3198 op1.use(); 3199 3200 if (!(m_state.forNode(node->child1()).m_type & ~(SpecNumber | SpecBoolean))) 3201 m_jit.move(op1GPR, resultGPR); 3202 else { 3203 MacroAssembler::Jump alreadyPrimitive = m_jit.branchTest64(MacroAssembler::NonZero, op1GPR, GPRInfo::tagMaskRegister); 3204 MacroAssembler::Jump notPrimitive = m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR, JSCell::structureOffset()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 3205 3206 alreadyPrimitive.link(&m_jit); 3207 m_jit.move(op1GPR, resultGPR); 3208 3209 addSlowPathGenerator( 3210 slowPathCall(notPrimitive, this, operationToPrimitive, resultGPR, op1GPR)); 3211 } 3212 3213 jsValueResult(resultGPR, node, UseChildrenCalledExplicitly); 3214 break; 3215 } 3216 3217 case ToString: { 3218 if (node->child1().useKind() == UntypedUse) { 3208 3219 JSValueOperand op1(this, node->child1()); 3209 GPRTemporary result(this, op1);3210 3211 3220 GPRReg op1GPR = op1.gpr(); 3221 3222 GPRResult result(this); 3212 3223 GPRReg resultGPR = result.gpr(); 3213 3214 op1.use(); 3215 3216 if (!(m_state.forNode(node->child1()).m_type & ~(SpecNumber | SpecBoolean))) 3217 m_jit.move(op1GPR, resultGPR); 3218 else { 3219 MacroAssembler::Jump alreadyPrimitive = m_jit.branchTest64(MacroAssembler::NonZero, op1GPR, GPRInfo::tagMaskRegister); 3220 MacroAssembler::Jump notPrimitive = m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR, JSCell::structureOffset()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 3221 3222 alreadyPrimitive.link(&m_jit); 3223 m_jit.move(op1GPR, resultGPR); 3224 3225 addSlowPathGenerator( 3226 slowPathCall(notPrimitive, this, operationToPrimitive, resultGPR, op1GPR)); 3224 3225 flushRegisters(); 3226 3227 JITCompiler::Jump done; 3228 if (node->child1()->prediction() & SpecString) { 3229 JITCompiler::Jump slowPath = m_jit.branchTest64( 3230 JITCompiler::NonZero, op1GPR, GPRInfo::tagMaskRegister); 3231 done = m_jit.branchPtr( 3232 JITCompiler::Equal, 3233 JITCompiler::Address(op1GPR, JSCell::structureOffset()), 3234 TrustedImmPtr(m_jit.globalData()->stringStructure.get())); 3235 slowPath.link(&m_jit); 3227 3236 } 3228 3229 jsValueResult(resultGPR, node, UseChildrenCalledExplicitly); 3230 break; 3231 } 3232 3233 default: 3234 RELEASE_ASSERT_NOT_REACHED(); 3235 break; 3236 } 3237 callOperation(operationToString, resultGPR, op1GPR); 3238 if (done.isSet()) 3239 done.link(&m_jit); 3240 cellResult(resultGPR, node); 3241 break; 3242 } 3243 3244 compileToStringOnCell(node); 3245 break; 3246 } 3247 3248 case NewStringObject: { 3249 compileNewStringObject(node); 3237 3250 break; 3238 3251 } -
trunk/Source/JavaScriptCore/dfg/DFGUseKind.cpp
r143654 r146089 72 72 out.print("String"); 73 73 break; 74 case KnownStringUse: 75 out.print("KnownString"); 76 break; 77 case StringObjectUse: 78 out.print("StringObject"); 79 break; 80 case StringOrStringObjectUse: 81 out.print("StringOrStringObject"); 82 break; 74 83 case NotCellUse: 75 84 out.print("NotCell"); -
trunk/Source/JavaScriptCore/dfg/DFGUseKind.h
r143654 r146089 49 49 ObjectOrOtherUse, 50 50 StringUse, 51 KnownStringUse, 52 StringObjectUse, 53 StringOrStringObjectUse, 51 54 NotCellUse, 52 55 OtherUse, … … 77 80 return SpecObject | SpecOther; 78 81 case StringUse: 82 case KnownStringUse: 79 83 return SpecString; 84 case StringObjectUse: 85 return SpecStringObject; 86 case StringOrStringObjectUse: 87 return SpecString | SpecStringObject; 80 88 case NotCellUse: 81 89 return ~SpecCell; -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r146071 r146089 95 95 static const HashTable* regExpConstructorTable(CallFrame* callFrame) { return callFrame->globalData().regExpConstructorTable; } 96 96 static const HashTable* regExpPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().regExpPrototypeTable; } 97 static const HashTable* stringTable(CallFrame* callFrame) { return callFrame->globalData().stringTable; }98 97 static const HashTable* stringConstructorTable(CallFrame* callFrame) { return callFrame->globalData().stringConstructorTable; } 99 98 -
trunk/Source/JavaScriptCore/runtime/Intrinsic.h
r111129 r146089 48 48 RegExpExecIntrinsic, 49 49 RegExpTestIntrinsic, 50 StringPrototypeValueOfIntrinsic 50 51 }; 51 52 -
trunk/Source/JavaScriptCore/runtime/JSDestructibleObject.h
r130303 r146089 15 15 16 16 const ClassInfo* classInfo() const { return m_classInfo; } 17 18 static ptrdiff_t classInfoOffset() { return OBJECT_OFFSETOF(JSDestructibleObject, m_classInfo); } 17 19 18 20 protected: -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r146071 r146089 98 98 extern const HashTable regExpConstructorTable; 99 99 extern const HashTable regExpPrototypeTable; 100 extern const HashTable stringTable;101 100 extern const HashTable stringConstructorTable; 102 101 … … 159 158 , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) 160 159 , regExpPrototypeTable(fastNew<HashTable>(JSC::regExpPrototypeTable)) 161 , stringTable(fastNew<HashTable>(JSC::stringTable))162 160 , stringConstructorTable(fastNew<HashTable>(JSC::stringConstructorTable)) 163 161 , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) … … 289 287 regExpConstructorTable->deleteTable(); 290 288 regExpPrototypeTable->deleteTable(); 291 stringTable->deleteTable();292 289 stringConstructorTable->deleteTable(); 293 290 … … 308 305 fastDelete(const_cast<HashTable*>(regExpConstructorTable)); 309 306 fastDelete(const_cast<HashTable*>(regExpPrototypeTable)); 310 fastDelete(const_cast<HashTable*>(stringTable));311 307 fastDelete(const_cast<HashTable*>(stringConstructorTable)); 312 308 -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.h
r146071 r146089 231 231 const HashTable* regExpConstructorTable; 232 232 const HashTable* regExpPrototypeTable; 233 const HashTable* stringTable;234 233 const HashTable* stringConstructorTable; 235 234 -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r146071 r146089 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 4 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2012 Apple Inc. All rights reserved.4 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2012, 2013 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2007 Eric Seidel (eric@webkit.org) 6 6 * … … 31 31 #include "DatePrototype.h" 32 32 #include "ErrorConstructor.h" 33 #include "Executable.h" 33 34 #include "GetterSetter.h" 34 35 #include "IndexingHeaderInlines.h" -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r146071 r146089 1455 1455 // Use this macro from within finishCreation() methods in prototypes. This assumes 1456 1456 // you've defined variables called exec, globalObject, and globalData, and they 1457 // have the expected meanings. This also assumes that the function you're defining 1458 // doesn't have an intrinsic. 1457 // have the expected meanings. 1458 #define JSC_NATIVE_INTRINSIC_FUNCTION(jsName, cppName, attributes, length, intrinsic) \ 1459 putDirectNativeFunction(\ 1460 exec, globalObject, Identifier(exec, #jsName), (length), cppName, \ 1461 (intrinsic), (attributes)) 1462 1463 // As above, but this assumes that the function you're defining doesn't have an 1464 // intrinsic. 1459 1465 #define JSC_NATIVE_FUNCTION(jsName, cppName, attributes, length) \ 1460 putDirectNativeFunction(exec, globalObject, globalData.propertyNames->jsName, (length), cppName, NoIntrinsic, (attributes))1466 JSC_NATIVE_INTRINSIC_FUNCTION(jsName, cppName, (attributes), (length), NoIntrinsic) 1461 1467 1462 1468 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSWrapperObject.h
r130303 r146089 33 33 typedef JSDestructibleObject Base; 34 34 35 static size_t allocationSize(size_t inlineCapacity) 36 { 37 ASSERT_UNUSED(inlineCapacity, !inlineCapacity); 38 return sizeof(JSWrapperObject); 39 } 40 35 41 JSValue internalValue() const; 36 42 void setInternalValue(JSGlobalData&, JSValue); … … 39 45 { 40 46 return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info); 47 } 48 49 static ptrdiff_t internalValueOffset() { return OBJECT_OFFSETOF(JSWrapperObject, m_internalValue); } 50 static ptrdiff_t internalValueCellOffset() 51 { 52 #if USE(JSVALUE64) 53 return internalValueOffset(); 54 #else 55 return internalValueOffset() + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload); 56 #endif 41 57 } 42 58 -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r135800 r146089 1 1 /* 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2009 Torch Mobile, Inc. 5 5 * … … 83 83 static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*); 84 84 85 } 86 87 #include "StringPrototype.lut.h" 88 89 namespace JSC { 90 91 const ClassInfo StringPrototype::s_info = { "String", &StringObject::s_info, 0, ExecState::stringTable, CREATE_METHOD_TABLE(StringPrototype) }; 92 93 /* Source for StringPrototype.lut.h 94 @begin stringTable 26 95 toString stringProtoFuncToString DontEnum|Function 0 96 valueOf stringProtoFuncToString DontEnum|Function 0 97 charAt stringProtoFuncCharAt DontEnum|Function 1 98 charCodeAt stringProtoFuncCharCodeAt DontEnum|Function 1 99 concat stringProtoFuncConcat DontEnum|Function 1 100 indexOf stringProtoFuncIndexOf DontEnum|Function 1 101 lastIndexOf stringProtoFuncLastIndexOf DontEnum|Function 1 102 match stringProtoFuncMatch DontEnum|Function 1 103 replace stringProtoFuncReplace DontEnum|Function 2 104 search stringProtoFuncSearch DontEnum|Function 1 105 slice stringProtoFuncSlice DontEnum|Function 2 106 split stringProtoFuncSplit DontEnum|Function 2 107 substr stringProtoFuncSubstr DontEnum|Function 2 108 substring stringProtoFuncSubstring DontEnum|Function 2 109 toLowerCase stringProtoFuncToLowerCase DontEnum|Function 0 110 toUpperCase stringProtoFuncToUpperCase DontEnum|Function 0 111 localeCompare stringProtoFuncLocaleCompare DontEnum|Function 1 112 113 # toLocaleLowerCase and toLocaleUpperCase are currently identical to toLowerCase and toUpperCase 114 toLocaleLowerCase stringProtoFuncToLowerCase DontEnum|Function 0 115 toLocaleUpperCase stringProtoFuncToUpperCase DontEnum|Function 0 116 117 big stringProtoFuncBig DontEnum|Function 0 118 small stringProtoFuncSmall DontEnum|Function 0 119 blink stringProtoFuncBlink DontEnum|Function 0 120 bold stringProtoFuncBold DontEnum|Function 0 121 fixed stringProtoFuncFixed DontEnum|Function 0 122 italics stringProtoFuncItalics DontEnum|Function 0 123 strike stringProtoFuncStrike DontEnum|Function 0 124 sub stringProtoFuncSub DontEnum|Function 0 125 sup stringProtoFuncSup DontEnum|Function 0 126 fontcolor stringProtoFuncFontcolor DontEnum|Function 1 127 fontsize stringProtoFuncFontsize DontEnum|Function 1 128 anchor stringProtoFuncAnchor DontEnum|Function 1 129 link stringProtoFuncLink DontEnum|Function 1 130 trim stringProtoFuncTrim DontEnum|Function 0 131 trimLeft stringProtoFuncTrimLeft DontEnum|Function 0 132 trimRight stringProtoFuncTrimRight DontEnum|Function 0 133 @end 134 */ 85 const ClassInfo StringPrototype::s_info = { "String", &StringObject::s_info, 0, 0, CREATE_METHOD_TABLE(StringPrototype) }; 135 86 136 87 // ECMA 15.5.4 … … 140 91 } 141 92 142 void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject*, JSString* nameAndMessage) 143 { 144 Base::finishCreation(exec->globalData(), nameAndMessage); 93 void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject, JSString* nameAndMessage) 94 { 95 JSGlobalData& globalData = exec->globalData(); 96 97 Base::finishCreation(globalData, nameAndMessage); 145 98 ASSERT(inherits(&s_info)); 99 100 JSC_NATIVE_INTRINSIC_FUNCTION(toString, stringProtoFuncToString, DontEnum, 0, StringPrototypeValueOfIntrinsic); 101 JSC_NATIVE_INTRINSIC_FUNCTION(valueOf, stringProtoFuncToString, DontEnum, 0, StringPrototypeValueOfIntrinsic); 102 JSC_NATIVE_INTRINSIC_FUNCTION(charAt, stringProtoFuncCharAt, DontEnum, 1, CharAtIntrinsic); 103 JSC_NATIVE_INTRINSIC_FUNCTION(charCodeAt, stringProtoFuncCharCodeAt, DontEnum, 1, CharCodeAtIntrinsic); 104 JSC_NATIVE_FUNCTION(concat, stringProtoFuncConcat, DontEnum, 1); 105 JSC_NATIVE_FUNCTION(indexOf, stringProtoFuncIndexOf, DontEnum, 1); 106 JSC_NATIVE_FUNCTION(lastIndexOf, stringProtoFuncLastIndexOf, DontEnum, 1); 107 JSC_NATIVE_FUNCTION(match, stringProtoFuncMatch, DontEnum, 1); 108 JSC_NATIVE_FUNCTION(replace, stringProtoFuncReplace, DontEnum, 2); 109 JSC_NATIVE_FUNCTION(search, stringProtoFuncSearch, DontEnum, 1); 110 JSC_NATIVE_FUNCTION(slice, stringProtoFuncSlice, DontEnum, 2); 111 JSC_NATIVE_FUNCTION(split, stringProtoFuncSplit, DontEnum, 2); 112 JSC_NATIVE_FUNCTION(substr, stringProtoFuncSubstr, DontEnum, 2); 113 JSC_NATIVE_FUNCTION(substring, stringProtoFuncSubstring, DontEnum, 2); 114 JSC_NATIVE_FUNCTION(toLowerCase, stringProtoFuncToLowerCase, DontEnum, 0); 115 JSC_NATIVE_FUNCTION(toUpperCase, stringProtoFuncToUpperCase, DontEnum, 0); 116 JSC_NATIVE_FUNCTION(localeCompare, stringProtoFuncLocaleCompare, DontEnum, 1); 117 JSC_NATIVE_FUNCTION(toLocaleLowerCase, stringProtoFuncToLowerCase, DontEnum, 0); 118 JSC_NATIVE_FUNCTION(toLocaleUpperCase, stringProtoFuncToUpperCase, DontEnum, 0); 119 JSC_NATIVE_FUNCTION(big, stringProtoFuncBig, DontEnum, 0); 120 JSC_NATIVE_FUNCTION(small, stringProtoFuncSmall, DontEnum, 0); 121 JSC_NATIVE_FUNCTION(blink, stringProtoFuncBlink, DontEnum, 0); 122 JSC_NATIVE_FUNCTION(bold, stringProtoFuncBold, DontEnum, 0); 123 JSC_NATIVE_FUNCTION(fixed, stringProtoFuncFixed, DontEnum, 0); 124 JSC_NATIVE_FUNCTION(italics, stringProtoFuncItalics, DontEnum, 0); 125 JSC_NATIVE_FUNCTION(strike, stringProtoFuncStrike, DontEnum, 0); 126 JSC_NATIVE_FUNCTION(sub, stringProtoFuncSub, DontEnum, 0); 127 JSC_NATIVE_FUNCTION(sup, stringProtoFuncSup, DontEnum, 0); 128 JSC_NATIVE_FUNCTION(fontcolor, stringProtoFuncFontcolor, DontEnum, 1); 129 JSC_NATIVE_FUNCTION(fontsize, stringProtoFuncFontsize, DontEnum, 1); 130 JSC_NATIVE_FUNCTION(anchor, stringProtoFuncAnchor, DontEnum, 1); 131 JSC_NATIVE_FUNCTION(link, stringProtoFuncLink, DontEnum, 1); 132 JSC_NATIVE_FUNCTION(trim, stringProtoFuncTrim, DontEnum, 0); 133 JSC_NATIVE_FUNCTION(trimLeft, stringProtoFuncTrimLeft, DontEnum, 0); 134 JSC_NATIVE_FUNCTION(trimRight, stringProtoFuncTrimRight, DontEnum, 0); 146 135 147 136 // The constructor will be added later, after StringConstructor has been built … … 149 138 } 150 139 151 bool StringPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) 152 { 153 return getStaticFunctionSlot<StringObject>(exec, ExecState::stringTable(exec), jsCast<StringPrototype*>(cell), propertyName, slot); 154 } 155 156 bool StringPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) 157 { 158 return getStaticFunctionDescriptor<StringObject>(exec, ExecState::stringTable(exec), jsCast<StringPrototype*>(object), propertyName, descriptor); 140 StringPrototype* StringPrototype::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 141 { 142 JSString* empty = jsEmptyString(exec); 143 StringPrototype* prototype = new (NotNull, allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, structure); 144 prototype->finishCreation(exec, globalObject, empty); 145 return prototype; 159 146 } 160 147 -
trunk/Source/JavaScriptCore/runtime/StringPrototype.h
r116828 r146089 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 35 35 typedef StringObject Base; 36 36 37 static StringPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 38 { 39 JSString* empty = jsEmptyString(exec); 40 StringPrototype* prototype = new (NotNull, allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, structure); 41 prototype->finishCreation(exec, globalObject, empty); 42 return prototype; 43 } 44 45 static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); 46 static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); 37 static StringPrototype* create(ExecState*, JSGlobalObject*, Structure*); 47 38 48 39 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) … … 55 46 protected: 56 47 void finishCreation(ExecState*, JSGlobalObject*, JSString*); 57 static const unsigned StructureFlags = OverridesGetOwnPropertySlot |StringObject::StructureFlags;48 static const unsigned StructureFlags = StringObject::StructureFlags; 58 49 59 50 };
Note: See TracChangeset
for help on using the changeset viewer.