| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 | 181 |
| 182 Activate(code); | 182 Activate(code); |
| 183 DCHECK(!NeedsImmovableCode() || | 183 DCHECK(!NeedsImmovableCode() || |
| 184 heap->lo_space()->Contains(code) || | 184 heap->lo_space()->Contains(code) || |
| 185 heap->code_space()->FirstPage()->Contains(code->address())); | 185 heap->code_space()->FirstPage()->Contains(code->address())); |
| 186 return Handle<Code>(code, isolate()); | 186 return Handle<Code>(code, isolate()); |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 const char* CodeStub::MajorName(CodeStub::Major major_key, | 190 const char* CodeStub::MajorName(CodeStub::Major major_key) { |
| 191 bool allow_unknown_keys) { | |
| 192 switch (major_key) { | 191 switch (major_key) { |
| 193 #define DEF_CASE(name) case name: return #name "Stub"; | 192 #define DEF_CASE(name) case name: return #name "Stub"; |
| 194 CODE_STUB_LIST(DEF_CASE) | 193 CODE_STUB_LIST(DEF_CASE) |
| 195 #undef DEF_CASE | 194 #undef DEF_CASE |
| 196 case NoCache: | 195 case NoCache: |
| 197 return "<NoCache>Stub"; | 196 return "<NoCache>Stub"; |
| 198 case NUMBER_OF_IDS: | 197 case NUMBER_OF_IDS: |
| 199 UNREACHABLE(); | 198 UNREACHABLE(); |
| 200 return NULL; | 199 return NULL; |
| 201 } | 200 } |
| 202 return NULL; | 201 return NULL; |
| 203 } | 202 } |
| 204 | 203 |
| 205 | 204 |
| 206 void CodeStub::PrintBaseName(std::ostream& os) const { // NOLINT | 205 void CodeStub::PrintBaseName(std::ostream& os) const { // NOLINT |
| 207 os << MajorName(MajorKey(), false); | 206 os << MajorName(MajorKey()); |
| 208 } | 207 } |
| 209 | 208 |
| 210 | 209 |
| 211 void CodeStub::PrintName(std::ostream& os) const { // NOLINT | 210 void CodeStub::PrintName(std::ostream& os) const { // NOLINT |
| 212 PrintBaseName(os); | 211 PrintBaseName(os); |
| 213 PrintState(os); | 212 PrintState(os); |
| 214 } | 213 } |
| 215 | 214 |
| 216 | 215 |
| 217 void CodeStub::Dispatch(Isolate* isolate, uint32_t key, void** value_out, | 216 void CodeStub::Dispatch(Isolate* isolate, uint32_t key, void** value_out, |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 Handle<JSFunction> function = Handle<JSFunction>::cast(fun.ToHandleChecked()); | 473 Handle<JSFunction> function = Handle<JSFunction>::cast(fun.ToHandleChecked()); |
| 475 DCHECK(!function->IsUndefined() && | 474 DCHECK(!function->IsUndefined() && |
| 476 "JavaScript implementation of stub not found"); | 475 "JavaScript implementation of stub not found"); |
| 477 return function; | 476 return function; |
| 478 } | 477 } |
| 479 } // namespace | 478 } // namespace |
| 480 | 479 |
| 481 | 480 |
| 482 Handle<Code> TurboFanCodeStub::GenerateCode() { | 481 Handle<Code> TurboFanCodeStub::GenerateCode() { |
| 483 // Get the outer ("stub generator") function. | 482 // Get the outer ("stub generator") function. |
| 484 const char* name = CodeStub::MajorName(MajorKey(), false); | 483 const char* name = CodeStub::MajorName(MajorKey()); |
| 485 Handle<JSFunction> outer = GetFunction(isolate(), name); | 484 Handle<JSFunction> outer = GetFunction(isolate(), name); |
| 486 DCHECK_EQ(2, outer->shared()->length()); | 485 DCHECK_EQ(2, outer->shared()->length()); |
| 487 | 486 |
| 488 // Invoke the outer function to get the stub itself. | 487 // Invoke the outer function to get the stub itself. |
| 489 Factory* factory = isolate()->factory(); | 488 Factory* factory = isolate()->factory(); |
| 490 Handle<Object> call_conv = factory->InternalizeUtf8String(name); | 489 Handle<Object> call_conv = factory->InternalizeUtf8String(name); |
| 491 Handle<Object> minor_key = factory->NewNumber(MinorKey()); | 490 Handle<Object> minor_key = factory->NewNumber(MinorKey()); |
| 492 Handle<Object> args[] = {call_conv, minor_key}; | 491 Handle<Object> args[] = {call_conv, minor_key}; |
| 493 MaybeHandle<Object> result = Execution::Call( | 492 MaybeHandle<Object> result = Execution::Call( |
| 494 isolate(), outer, factory->undefined_value(), 2, args, false); | 493 isolate(), outer, factory->undefined_value(), 2, args, false); |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 | 1082 |
| 1084 if (type->Is(Type::UntaggedPointer())) { | 1083 if (type->Is(Type::UntaggedPointer())) { |
| 1085 return Representation::External(); | 1084 return Representation::External(); |
| 1086 } | 1085 } |
| 1087 | 1086 |
| 1088 DCHECK(!type->Is(Type::Untagged())); | 1087 DCHECK(!type->Is(Type::Untagged())); |
| 1089 return Representation::Tagged(); | 1088 return Representation::Tagged(); |
| 1090 } | 1089 } |
| 1091 } // namespace internal | 1090 } // namespace internal |
| 1092 } // namespace v8 | 1091 } // namespace v8 |
| OLD | NEW |