| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 233 |
| 234 // Create the code object. | 234 // Create the code object. |
| 235 CodeDesc desc; | 235 CodeDesc desc; |
| 236 masm.GetCode(&desc); | 236 masm.GetCode(&desc); |
| 237 | 237 |
| 238 // Copy the generated code into a heap object. | 238 // Copy the generated code into a heap object. |
| 239 Code::Flags flags = Code::ComputeFlags( | 239 Code::Flags flags = Code::ComputeFlags( |
| 240 GetCodeKind(), | 240 GetCodeKind(), |
| 241 GetICState(), | 241 GetICState(), |
| 242 GetExtraICState(), | 242 GetExtraICState(), |
| 243 GetStubType(), -1); | 243 GetStubType(), |
| 244 GetStubFlags()); |
| 244 Handle<Code> new_object = factory->NewCode( | 245 Handle<Code> new_object = factory->NewCode( |
| 245 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 246 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
| 246 return new_object; | 247 return new_object; |
| 247 } | 248 } |
| 248 | 249 |
| 249 | 250 |
| 250 template <class Stub> | 251 template <class Stub> |
| 251 static Handle<Code> DoGenerateCode(Stub* stub) { | 252 static Handle<Code> DoGenerateCode(Stub* stub) { |
| 252 Isolate* isolate = Isolate::Current(); | 253 Isolate* isolate = Isolate::Current(); |
| 253 CodeStub::Major major_key = | 254 CodeStub::Major major_key = |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 false, STANDARD_STORE, Representation::Tagged()); | 404 false, STANDARD_STORE, Representation::Tagged()); |
| 404 return load; | 405 return load; |
| 405 } | 406 } |
| 406 | 407 |
| 407 | 408 |
| 408 Handle<Code> KeyedLoadFastElementStub::GenerateCode() { | 409 Handle<Code> KeyedLoadFastElementStub::GenerateCode() { |
| 409 return DoGenerateCode(this); | 410 return DoGenerateCode(this); |
| 410 } | 411 } |
| 411 | 412 |
| 412 | 413 |
| 414 template<> |
| 415 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { |
| 416 Representation representation = casted_stub()->representation(); |
| 417 HInstruction* load = AddInstruction(new(zone()) HLoadNamedField( |
| 418 GetParameter(0), casted_stub()->is_inobject(), |
| 419 representation, casted_stub()->offset())); |
| 420 return load; |
| 421 } |
| 422 |
| 423 |
| 424 Handle<Code> LoadFieldStub::GenerateCode() { |
| 425 return DoGenerateCode(this); |
| 426 } |
| 427 |
| 428 |
| 429 template<> |
| 430 HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() { |
| 431 Representation representation = casted_stub()->representation(); |
| 432 HInstruction* load = AddInstruction(new(zone()) HLoadNamedField( |
| 433 GetParameter(0), casted_stub()->is_inobject(), |
| 434 representation, casted_stub()->offset())); |
| 435 return load; |
| 436 } |
| 437 |
| 438 |
| 439 Handle<Code> KeyedLoadFieldStub::GenerateCode() { |
| 440 return DoGenerateCode(this); |
| 441 } |
| 442 |
| 443 |
| 413 template <> | 444 template <> |
| 414 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { | 445 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { |
| 415 BuildUncheckedMonomorphicElementAccess( | 446 BuildUncheckedMonomorphicElementAccess( |
| 416 GetParameter(0), GetParameter(1), GetParameter(2), NULL, | 447 GetParameter(0), GetParameter(1), GetParameter(2), NULL, |
| 417 casted_stub()->is_js_array(), casted_stub()->elements_kind(), | 448 casted_stub()->is_js_array(), casted_stub()->elements_kind(), |
| 418 true, casted_stub()->store_mode(), Representation::Tagged()); | 449 true, casted_stub()->store_mode(), Representation::Tagged()); |
| 419 | 450 |
| 420 return GetParameter(2); | 451 return GetParameter(2); |
| 421 } | 452 } |
| 422 | 453 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 ? graph()->GetConstantSmi1() | 665 ? graph()->GetConstantSmi1() |
| 635 : graph()->GetConstantUndefined(); | 666 : graph()->GetConstantUndefined(); |
| 636 } | 667 } |
| 637 | 668 |
| 638 | 669 |
| 639 Handle<Code> CompareNilICStub::GenerateCode() { | 670 Handle<Code> CompareNilICStub::GenerateCode() { |
| 640 return DoGenerateCode(this); | 671 return DoGenerateCode(this); |
| 641 } | 672 } |
| 642 | 673 |
| 643 } } // namespace v8::internal | 674 } } // namespace v8::internal |
| OLD | NEW |