| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | |
| 29 | 28 |
| 30 #include "codegen.h" | 29 // This file relies on the fact that the following declaration has been made |
| 31 #include "deoptimizer.h" | 30 // in runtime.js: |
| 32 #include "full-codegen.h" | 31 // const $Object = global.Object; |
| 33 #include "safepoint-table.h" | 32 const $WeakMap = global.WeakMap; |
| 34 | 33 |
| 35 // Note: this file was taken from the X64 version. ARM has a partially working | 34 // ------------------------------------------------------------------- |
| 36 // lithium implementation, but for now it is not ported to mips. | |
| 37 | 35 |
| 38 namespace v8 { | 36 // Set the WeakMap function and constructor. |
| 39 namespace internal { | 37 %SetCode($WeakMap, function(x) { |
| 38 if (%_IsConstructCall()) { |
| 39 %WeakMapInitialize(this); |
| 40 } else { |
| 41 return new $WeakMap(); |
| 42 } |
| 43 }); |
| 40 | 44 |
| 41 | 45 |
| 42 int Deoptimizer::table_entry_size_ = 10; | 46 function WeakMapGet(key) { |
| 43 | 47 if (!IS_SPEC_OBJECT(key)) { |
| 44 | 48 throw %MakeTypeError('invalid_weakmap_key', [this, key]); |
| 45 int Deoptimizer::patch_size() { | 49 } |
| 46 const int kCallInstructionSizeInWords = 3; | 50 return %WeakMapGet(this, key); |
| 47 return kCallInstructionSizeInWords * Assembler::kInstrSize; | |
| 48 } | 51 } |
| 49 | 52 |
| 50 | 53 |
| 51 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { | 54 function WeakMapSet(key, value) { |
| 52 UNIMPLEMENTED(); | 55 if (!IS_SPEC_OBJECT(key)) { |
| 56 throw %MakeTypeError('invalid_weakmap_key', [this, key]); |
| 57 } |
| 58 return %WeakMapSet(this, key, value); |
| 53 } | 59 } |
| 54 | 60 |
| 55 | 61 |
| 56 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, | 62 function WeakMapHas(key) { |
| 57 Code* check_code, | 63 if (!IS_SPEC_OBJECT(key)) { |
| 58 Code* replacement_code) { | 64 throw %MakeTypeError('invalid_weakmap_key', [this, key]); |
| 59 UNIMPLEMENTED(); | 65 } |
| 66 return !IS_UNDEFINED(%WeakMapGet(this, key)); |
| 60 } | 67 } |
| 61 | 68 |
| 62 | 69 |
| 63 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, | 70 function WeakMapDelete(key) { |
| 64 Code* check_code, | 71 if (!IS_SPEC_OBJECT(key)) { |
| 65 Code* replacement_code) { | 72 throw %MakeTypeError('invalid_weakmap_key', [this, key]); |
| 66 UNIMPLEMENTED(); | 73 } |
| 74 if (!IS_UNDEFINED(%WeakMapGet(this, key))) { |
| 75 %WeakMapSet(this, key, void 0); |
| 76 return true; |
| 77 } else { |
| 78 return false; |
| 79 } |
| 80 } |
| 81 |
| 82 // ------------------------------------------------------------------- |
| 83 |
| 84 function SetupWeakMap() { |
| 85 // Setup the non-enumerable functions on the WeakMap prototype object. |
| 86 InstallFunctionsOnHiddenPrototype($WeakMap.prototype, DONT_ENUM, $Array( |
| 87 "get", WeakMapGet, |
| 88 "set", WeakMapSet, |
| 89 "has", WeakMapHas, |
| 90 "delete", WeakMapDelete |
| 91 )); |
| 67 } | 92 } |
| 68 | 93 |
| 69 | 94 |
| 70 void Deoptimizer::DoComputeOsrOutputFrame() { | 95 SetupWeakMap(); |
| 71 UNIMPLEMENTED(); | |
| 72 } | |
| 73 | |
| 74 | |
| 75 void Deoptimizer::DoComputeFrame(TranslationIterator* iterator, | |
| 76 int frame_index) { | |
| 77 UNIMPLEMENTED(); | |
| 78 } | |
| 79 | |
| 80 | |
| 81 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { | |
| 82 UNIMPLEMENTED(); | |
| 83 } | |
| 84 | |
| 85 | |
| 86 void Deoptimizer::EntryGenerator::Generate() { | |
| 87 UNIMPLEMENTED(); | |
| 88 } | |
| 89 | |
| 90 | |
| 91 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { | |
| 92 UNIMPLEMENTED(); | |
| 93 } | |
| 94 | |
| 95 | |
| 96 } } // namespace v8::internal | |
| OLD | NEW |