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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 MacroAssembler masm(isolate, NULL, 256); | 107 MacroAssembler masm(isolate, NULL, 256); |
108 GenerateCode(&masm); | 108 GenerateCode(&masm); |
109 | 109 |
110 // Create the code object. | 110 // Create the code object. |
111 CodeDesc desc; | 111 CodeDesc desc; |
112 masm.GetCode(&desc); | 112 masm.GetCode(&desc); |
113 | 113 |
114 // Copy the generated code into a heap object. | 114 // Copy the generated code into a heap object. |
115 Code::Flags flags = Code::ComputeFlags( | 115 Code::Flags flags = Code::ComputeFlags( |
116 static_cast<Code::Kind>(GetCodeKind()), | 116 static_cast<Code::Kind>(GetCodeKind()), |
117 InLoop(), | |
118 GetICState()); | 117 GetICState()); |
119 Handle<Code> new_object = factory->NewCode( | 118 Handle<Code> new_object = factory->NewCode( |
120 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 119 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
121 RecordCodeGeneration(*new_object, &masm); | 120 RecordCodeGeneration(*new_object, &masm); |
122 FinishCode(*new_object); | 121 FinishCode(*new_object); |
123 | 122 |
124 // Update the dictionary and the root in Heap. | 123 // Update the dictionary and the root in Heap. |
125 Handle<NumberDictionary> dict = | 124 Handle<NumberDictionary> dict = |
126 factory->DictionaryAtNumberPut( | 125 factory->DictionaryAtNumberPut( |
127 Handle<NumberDictionary>(heap->code_stubs()), | 126 Handle<NumberDictionary>(heap->code_stubs()), |
(...skipping 17 matching lines...) Expand all Loading... |
145 GenerateCode(&masm); | 144 GenerateCode(&masm); |
146 Heap* heap = masm.isolate()->heap(); | 145 Heap* heap = masm.isolate()->heap(); |
147 | 146 |
148 // Create the code object. | 147 // Create the code object. |
149 CodeDesc desc; | 148 CodeDesc desc; |
150 masm.GetCode(&desc); | 149 masm.GetCode(&desc); |
151 | 150 |
152 // Try to copy the generated code into a heap object. | 151 // Try to copy the generated code into a heap object. |
153 Code::Flags flags = Code::ComputeFlags( | 152 Code::Flags flags = Code::ComputeFlags( |
154 static_cast<Code::Kind>(GetCodeKind()), | 153 static_cast<Code::Kind>(GetCodeKind()), |
155 InLoop(), | |
156 GetICState()); | 154 GetICState()); |
157 Object* new_object; | 155 Object* new_object; |
158 { MaybeObject* maybe_new_object = | 156 { MaybeObject* maybe_new_object = |
159 heap->CreateCode(desc, flags, masm.CodeObject()); | 157 heap->CreateCode(desc, flags, masm.CodeObject()); |
160 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; | 158 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; |
161 } | 159 } |
162 code = Code::cast(new_object); | 160 code = Code::cast(new_object); |
163 RecordCodeGeneration(code, &masm); | 161 RecordCodeGeneration(code, &masm); |
164 FinishCode(code); | 162 FinishCode(code); |
165 | 163 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 case READ_ELEMENT: type_name = "ReadElement"; break; | 307 case READ_ELEMENT: type_name = "ReadElement"; break; |
310 case NEW_NON_STRICT_FAST: type_name = "NewNonStrictFast"; break; | 308 case NEW_NON_STRICT_FAST: type_name = "NewNonStrictFast"; break; |
311 case NEW_NON_STRICT_SLOW: type_name = "NewNonStrictSlow"; break; | 309 case NEW_NON_STRICT_SLOW: type_name = "NewNonStrictSlow"; break; |
312 case NEW_STRICT: type_name = "NewStrict"; break; | 310 case NEW_STRICT: type_name = "NewStrict"; break; |
313 } | 311 } |
314 stream->Add("ArgumentsAccessStub_%s", type_name); | 312 stream->Add("ArgumentsAccessStub_%s", type_name); |
315 } | 313 } |
316 | 314 |
317 | 315 |
318 void CallFunctionStub::PrintName(StringStream* stream) { | 316 void CallFunctionStub::PrintName(StringStream* stream) { |
319 const char* in_loop_name = NULL; // Make g++ happy. | |
320 switch (in_loop_) { | |
321 case NOT_IN_LOOP: in_loop_name = ""; break; | |
322 case IN_LOOP: in_loop_name = "_InLoop"; break; | |
323 } | |
324 const char* flags_name = NULL; // Make g++ happy. | 317 const char* flags_name = NULL; // Make g++ happy. |
325 switch (flags_) { | 318 switch (flags_) { |
326 case NO_CALL_FUNCTION_FLAGS: flags_name = ""; break; | 319 case NO_CALL_FUNCTION_FLAGS: flags_name = ""; break; |
327 case RECEIVER_MIGHT_BE_IMPLICIT: flags_name = "_Implicit"; break; | 320 case RECEIVER_MIGHT_BE_IMPLICIT: flags_name = "_Implicit"; break; |
328 } | 321 } |
329 stream->Add("CallFunctionStub_Args%d%s%s", argc_, in_loop_name, flags_name); | 322 stream->Add("CallFunctionStub_Args%d%s", argc_, flags_name); |
330 } | 323 } |
331 | 324 |
332 | 325 |
333 void ToBooleanStub::PrintName(StringStream* stream) { | 326 void ToBooleanStub::PrintName(StringStream* stream) { |
334 stream->Add("ToBooleanStub_"); | 327 stream->Add("ToBooleanStub_"); |
335 types_.Print(stream); | 328 types_.Print(stream); |
336 } | 329 } |
337 | 330 |
338 | 331 |
339 void ToBooleanStub::Types::Print(StringStream* stream) const { | 332 void ToBooleanStub::Types::Print(StringStream* stream) const { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 396 } |
404 | 397 |
405 | 398 |
406 bool ToBooleanStub::Types::CanBeUndetectable() const { | 399 bool ToBooleanStub::Types::CanBeUndetectable() const { |
407 return Contains(ToBooleanStub::SPEC_OBJECT) | 400 return Contains(ToBooleanStub::SPEC_OBJECT) |
408 || Contains(ToBooleanStub::STRING); | 401 || Contains(ToBooleanStub::STRING); |
409 } | 402 } |
410 | 403 |
411 | 404 |
412 } } // namespace v8::internal | 405 } } // namespace v8::internal |
OLD | NEW |