Hi Masaya,
I'll suggest continuing this discussion on the bug. As bugzilla is made for
such discussion, and is better than mailing list for this purpose.
On 04/04/2013 11:51 AM, 井関正也 wrote:
2013年4月1日月曜日 23時32分28秒 UTC+9 井関正也:
I'm interested in IonMonkey.
I read some code in js/src/ion.But I can't understand how IonMonkey analyze the
code.
When type javascript code in console or commnad line , What function call
firstly?
Oh ! I understand.
Thanks.
I make member function
MDefinition *
MConcat::foldsTo(bool useValueNumbers)
{
if ((type() == MIRType_String) && (rhs()->isConstant()))
{
if((type() == MIRType_String) && (lhs()->isConstant()))
{
return MConstant::New(MergeStrValue);
}
else
{
return MConstant::New(rhs()->toConstant()->value());
}
}
return this;
}
I'd like to merger JSString. I think I use js::ConcatStrings. But It doesn't
have JSContext in this scope.
there are other way?
Hum …
the JSContext* has not been added here because this code can run in a
parallel thread when we are compiling, and we should not add a JSContext here.
The only case where we can allocate these GC object (new strings) is in the
link phase. So we need to store create a new MConstant MIR node which wrap
a buffer containing the content of the new string which would be allocated
in the link phase (CodeGenerator::link).
To do that you will have to add an index into the CodeGeneratorShared class
which will refer to locations which have to be patched during the link
phase, such as the constant index in the constant pool (see
CodeGeneratorShared::encodeSlots) can be updated after we have completed the
construction of the assembly.
tl;dr:
- Create a new type similar to MConstant. (MIR.h, MOpcode.h)
- Add it to the lowering. (LIR-Common.h & Lowering.cpp & LOpcode.h)
- Add a CodeGenerator function for it. (CodeGenerator.cpp)
- Allocate a slot in the snapshot for this new MIR type.
(CodeGeneratorShared::encodeSlots)
- Iterate on the vector of patch offset to allocate the new strings
(CodeGenerator::link)
--
Nicolas B. Pierron
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals